-
Notifications
You must be signed in to change notification settings - Fork 99
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
Conversation
@@ -67,6 +67,7 @@ const configureAuditLog = app => { | |||
setAuditLogToFeathersService({ app, serviceName: 'donations' }); | |||
setAuditLogToFeathersService({ app, serviceName: 'pledgeAdmins' }); | |||
setAuditLogToFeathersService({ app, serviceName: 'events' }); | |||
setAuditLogToFeathersService({ app, serviceName: 'emails' }); |
There was a problem hiding this comment.
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'], |
There was a problem hiding this comment.
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
feathers-giveth/src/blockchain/lib/eventHandlerQueue.js
Lines 26 to 30 in f245076
await eventService.remove(null, { | |
query: { id, transactionHash, status: { $in: [EventStatus.PENDING, EventStatus.WAITING] } }, | |
}); | |
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
We have two main problems on #594
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
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 notProcessed