From 6576c98ddb15fa2e07ca41896c2a6039da204a09 Mon Sep 17 00:00:00 2001 From: Sid Sethi <3323835+SidSethi@users.noreply.github.com> Date: Tue, 17 May 2022 21:31:46 -0400 Subject: [PATCH] replace file removal log with decision tree stage (#3114) --- creator-node/src/routes/files.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/creator-node/src/routes/files.js b/creator-node/src/routes/files.js index 689341a2fa7..dccf66f51a7 100644 --- a/creator-node/src/routes/files.js +++ b/creator-node/src/routes/files.js @@ -232,8 +232,10 @@ const getCID = async (req, res) => { if (CID !== EMPTY_FILE_CID && fsStats.size === 0) { // Remove file if it is empty and force fetch from CN network - req.logger.warn(`[new path] File is empty -- removing ${CID}`) await fs.unlink(storagePath) + decisionTree.push({ + stage: `EMPTY_FILE_FOUND_AND_REMOVED_NEW_PATH` + }) } else { fileFoundOnFS = true } @@ -311,8 +313,10 @@ const getCID = async (req, res) => { }) if (CID !== EMPTY_FILE_CID && fsStats.size === 0) { // Remove file if it is empty and force fetch from CN network - req.logger.warn(`[legacy path] File is empty -- removing ${CID}`) await fs.unlink(storagePath) + decisionTree.push({ + stage: `EMPTY_FILE_FOUND_AND_REMOVED_LEGACY_PATH` + }) } else { fileFoundOnFS = true }