From 1a8636c7a024724b7dbd707df05182b0a6ddc1d8 Mon Sep 17 00:00:00 2001 From: maxceem Date: Fri, 16 Oct 2020 15:34:05 +0300 Subject: [PATCH] feat: enable phase create/update handlers --- src/services/ProcessorServicePhase.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/services/ProcessorServicePhase.js b/src/services/ProcessorServicePhase.js index 80fdaa8..1019947 100644 --- a/src/services/ProcessorServicePhase.js +++ b/src/services/ProcessorServicePhase.js @@ -66,14 +66,8 @@ async function create (message) { return _.assign(doc._source, { phases }) } - // NOTE Disable indexing phases when create at the moment, as it's now being indexed inside Project Service. - // It's because adding a phase may cause cascading updates of other phases and in such cases we are doing - // one ES index call instead of multiple calls. Otherwise ES may fail with error `version conflict`. - // This would be turned on back, as soon as we get rid of such cascading updates inside Project Service. - // - // await helper.updateProjectESPromise(message.projectId, updateDocPromise) - // logger.debug(`Project phase created successfully in elasticsearch index, (projectPhaseId: ${message.id})`) - logger.debug(`TEMPORARY SKIPPED: Project phase created successfully in elasticsearch index, (projectPhaseId: ${message.id})`) + await helper.updateProjectESPromise(message.projectId, updateDocPromise) + logger.debug(`Project phase created successfully in elasticsearch index, (projectPhaseId: ${message.id})`) } create.schema = { @@ -97,14 +91,8 @@ async function update (message) { return _.assign(doc._source, { phases }) } - // NOTE Disable indexing phases when update at the moment, as it's now being indexed inside Project Service. - // It's because updating a phase may cause cascading updates of other phases and in such cases we are doing - // one ES index call instead of multiple calls. Otherwise ES may fail with error `version conflict`. - // This would be turned on back, as soon as we get rid of such cascading updates inside Project Service. - // - // await helper.updateProjectESPromise(message.projectId, updateDocPromise) - // logger.debug(`Project phase updated successfully in elasticsearch index, (projectPhaseId: ${message.id})`) - logger.debug(`TEMPORARY SKIPPED: Project phase updated successfully in elasticsearch index, (projectPhaseId: ${message.id})`) + await helper.updateProjectESPromise(message.projectId, updateDocPromise) + logger.debug(`Project phase updated successfully in elasticsearch index, (projectPhaseId: ${message.id})`) } update.schema = {