From eb93fa5db7bfc46852fd4ed6b45fc2c5ebb49822 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 15 Oct 2018 12:04:14 -0300 Subject: [PATCH] Filesystem: Temporarily cache inode data until storage is chunked properly --- lib/filesystem.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/filesystem.js b/lib/filesystem.js index c80da828..0d5b0b94 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -1089,7 +1089,13 @@ FS.prototype.get_data = async function(idx) // jshint ignore:line dbg_assert(inode, `Filesystem get_data: idx ${idx} does not point to an inode`); if(this.inodedata[idx]) return this.inodedata[idx]; - if(inode.sha256sum && this.storage) return await this.storage.get(inode.sha256sum); // jshint ignore:line + if(inode.sha256sum && this.storage) + { + const data = await this.storage.get(inode.sha256sum); // jshint ignore:line + // XXX: Temporary cache until storage can properly chunk + this.inodedata[idx] = data; + return data; + } return null; }; // jshint ignore:line