From d79df08ba153ce1e0c5771ef96a950486a725d9a Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 10 Jul 2019 14:05:49 -0300 Subject: [PATCH] Improving log on file storage --- Integrations/FileStorage.js | 12 ++++++------ docker-compose.yml | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Integrations/FileStorage.js b/Integrations/FileStorage.js index c3b806345..a3fa31073 100644 --- a/Integrations/FileStorage.js +++ b/Integrations/FileStorage.js @@ -15,7 +15,7 @@ exports.newFileStorage = function newFileStorage() { async function getTextFile(container, filePath, callBackFunction) { try { - if (INFO_LOG === true) { console.log('[INFO] getTextFile: ' + container.toLowerCase() + '/' + filePath.substring(filePath.length - 110, filePath.length)) } + if (INFO_LOG === true) { console.log('[INFO] getTextFile: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length)) } let host = await getDevTeamHost(container) @@ -53,8 +53,8 @@ exports.newFileStorage = function newFileStorage() { } catch (err) { if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET') && currentRetry < MAX_RETRY) { - if (INFO_LOG === true) { console.log('[INFO] getTextFile -> Retrying connection to the server because received error: ' + err.code) } currentRetry++ + if (INFO_LOG === true) { console.log('[INFO] getTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry) } getTextFile(container, filePath, callBackFunction) } else { currentRetry = 0 @@ -66,7 +66,7 @@ exports.newFileStorage = function newFileStorage() { async function createTextFile(container, filePath, fileContent, callBackFunction) { try { - if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Entering function: ' + container.toLowerCase() + '/' + filePath.substring(filePath.length - 110, filePath.length)) } + if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Entering function: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length)) } let host = await getDevTeamHost(container) @@ -99,14 +99,14 @@ exports.newFileStorage = function newFileStorage() { message: response.data.errors[0] } callBackFunction(customErr) - } else{ + } else { callBackFunction(global.DEFAULT_OK_RESPONSE) } } catch (err) { - if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET') && currentRetry < MAX_RETRY) { - if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Retrying connection to the server because received error: ' + err.code) } + if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET' || err.message === "Request failed with status code 413") && currentRetry < MAX_RETRY) { currentRetry++ + if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry) } createTextFile(container, filePath, fileContent, callBackFunction) } else { currentRetry = 0 diff --git a/docker-compose.yml b/docker-compose.yml index 9a637ba97..ecdcf59ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: node: - image: superalgos/clone-executor:1.0.41 + image: superalgos/clone-executor:1.0.42 build: context: . dockerfile: ./Dockerfile diff --git a/package.json b/package.json index 6b26e1d8f..992f87c11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@superalgos/clone-executor", - "version": "1.0.41", + "version": "1.0.42", "description": "Module responsible for executing the bots on the cloud.", "author": "Superalgos, ltd.", "license": "Apache-2.0",