Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F 594 fix stuck event handler queue #598

Merged
merged 6 commits into from
Aug 25, 2021

Conversation

mohammadranjbarz
Copy link
Collaborator

We have two main problems on #594

  1. Why queue stocks on a job?
    I think maybe because rinkbey network or infura, ..., so a job stocks and other jobs cant start, now I check if after two minutes the job process doesn't end, I call done() manually to not block next jobs

  2. Why after restarting the backend, do some jobs process multiple times?
    we have some checking, for example, every 15 minutes we check if there is a Pending campaign we add a job to process that event, so when the queue is blocked for 5 hours, in this time we add 20(5hours * 4 times in an hour) jobs to process same event, so when we restart the application and the queue is not blocked anymore, we start to process the same event 20 times, for preventing this before handling event I check the event status in DB to be sure it's not Processed

@@ -67,6 +67,7 @@ const configureAuditLog = app => {
setAuditLogToFeathersService({ app, serviceName: 'donations' });
setAuditLogToFeathersService({ app, serviceName: 'pledgeAdmins' });
setAuditLogToFeathersService({ app, serviceName: 'events' });
setAuditLogToFeathersService({ app, serviceName: 'emails' });
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to #597, we add emails to elastik search it help us to better debug

@@ -1,5 +1,5 @@
const defaultFeatherMongooseOptions = {
multi: ['patch'],
multi: ['patch', 'remove'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We get an error in this line because we have blocked multiple delete (I saw it when I was reading the logs to fix this bug), so added remove to the whitelist

await eventService.remove(null, {
query: { id, transactionHash, status: { $in: [EventStatus.PENDING, EventStatus.WAITING] } },
});

@aminlatifi aminlatifi changed the title F 594 fix stock event handler queue F 594 fix stuck event handler queue Aug 25, 2021
event: event.event,
transactionHash: event.transactionHash,
status: event.status,
transactionIndex: event.transactionIndex,
logIndex: event.logIndex,
_id: event._id,
});
const eventInDb = await eventService.get(event._id);
if (eventInDb === EventStatus.PROCESSED) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be eventInDb.status

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aminlatifi
You are right, changed

@aminlatifi aminlatifi merged commit 8f7b2e3 into develop Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants