Skip to content

Commit 97ce674

Browse files
committed
fix: create phase topics on project create
1 parent 8ad7019 commit 97ce674

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/events/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const voidRabbitHandler = (logger, msg, channel) => {
3939
// we should completely remove the handlers for this events.
4040
export const rabbitHandlers = {
4141
'project.initial': projectCreatedHandler, // is only used `seedElasticsearchIndex.js` and can be removed
42-
[EVENT.ROUTING_KEY.PROJECT_DRAFT_CREATED]: voidRabbitHandler, // DISABLED
42+
[EVENT.ROUTING_KEY.PROJECT_DRAFT_CREATED]: projectCreatedHandler, // we have to call it, because it triggers topics creating for phases
4343
[EVENT.ROUTING_KEY.PROJECT_UPDATED]: voidRabbitHandler, // DISABLED
4444
[EVENT.ROUTING_KEY.PROJECT_DELETED]: voidRabbitHandler, // DISABLED
4545
[EVENT.ROUTING_KEY.PROJECT_MEMBER_ADDED]: voidRabbitHandler, // DISABLED

src/events/projects/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const eClient = util.getElasticSearchClient();
2121
* @param {Object} msg event payload which is essentially a project in JSON format
2222
* @returns {undefined}
2323
*/
24-
const indexProject = Promise.coroutine(function* (logger, msg) { // eslint-disable-line func-names
24+
const indexProject = Promise.coroutine(function* (logger, msg) { // eslint-disable-line func-names, no-unused-vars
2525
const data = JSON.parse(msg.content.toString());
2626
const userIds = data.members ? data.members.map(single => `userId:${single.userId}`) : [];
2727
try {
@@ -65,7 +65,9 @@ const indexProject = Promise.coroutine(function* (logger, msg) { // eslint-disab
6565
const projectCreatedHandler = Promise.coroutine(function* (logger, msg, channel) { // eslint-disable-line func-names
6666
const project = JSON.parse(msg.content.toString());
6767
try {
68-
yield indexProject(logger, msg);
68+
// we don't have to call indexing, as it's now handled by `project-processor-es`
69+
// yield indexProject(logger, msg);
70+
// we call this handle only for the sake of creating topics for the phases
6971
if (project.phases && project.phases.length > 0) {
7072
logger.debug('Phases found for the project, trying to create topics for each phase.');
7173
const topicPromises = _.map(project.phases, phase => createPhaseTopic(logger, phase));

0 commit comments

Comments
 (0)