mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-23 09:15:29 +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