Skip to content

Commit

Permalink
move location of timeout cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed May 17, 2024
1 parent 807b72e commit f3f6009
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/9p-filer.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,19 +969,20 @@ Virtio9p.prototype.ReceiveRequest = async function(bufchain) {
self.pendingTags[tag].data = data;
FSCACHE.set(path, {data: data, remaining: data.byteLength})
_read(data);
setTimeout(() => {
if (FSCACHE.has(path)) {
// console.log("Deleted FSCACHE entry for: " + path + "\nReason: over 1 minute");
FSCACHE.delete(path);
}
}, 60 * 1000)
});
else {
const file = FSCACHE.get(path);
file.remaining -= count;

self.pendingTags[tag].data = data;
_read(file.data)
setTimeout(() => {
if (FSCACHE.has(path)) {
// console.log("Deleted FSCACHE entry for: " + path + "\nReason: over 1 minute");
FSCACHE.delete(path);
}
}, 60 * 1000)

if (file.remaining <= 0) {
// console.log("Deleted FSCACHE entry for: " + path + "\nReason: Used up");
FSCACHE.delete(path);
Expand Down

0 comments on commit f3f6009

Please sign in to comment.