mirror of
https://github.com/BluemediaDev/muse.git
synced 2024-11-27 04:05:28 +01:00
fix(file-cache): try/catch to prevent concurrency issues
This commit is contained in:
parent
9afca25866
commit
3b2aa47e95
|
@ -58,10 +58,14 @@ export default class FileCacheProvider {
|
||||||
const stats = await fs.stat(tmpPath);
|
const stats = await fs.stat(tmpPath);
|
||||||
|
|
||||||
if (stats.size !== 0) {
|
if (stats.size !== 0) {
|
||||||
await fs.rename(tmpPath, finalPath);
|
try {
|
||||||
}
|
await fs.rename(tmpPath, finalPath);
|
||||||
|
|
||||||
await FileCache.create({hash, bytes: stats.size, accessedAt: new Date()});
|
await FileCache.create({hash, bytes: stats.size, accessedAt: new Date()});
|
||||||
|
} catch (e: unknown) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await this.evictOldestIfNecessary();
|
await this.evictOldestIfNecessary();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue