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

TimerQueueProcessor to scan DB for exisiting timers on init #455

Merged

Conversation

samarabbas
Copy link
Contributor

TimerQueueProcessor used to setup a very long timer on initialization to
notify processor for doing a DB scan. This becomes problematic when you
have existing timers and shard restarts. Now after initialization of
shard there is no trigger for the processor to perform a DB scan. It
now has to wait for a trigger from outside to perform the first scan so
it can start operating as usual.
This change removes the infite timer on initialize to perform first scan
immediately to check for existing timers.
Also some code cleanup and removing some unnecessary code.

fixes #454

TimerQueueProcessor used to setup a very long timer on initialization to
notify processor for doing a DB scan.  This becomes problematic when you
have existing timers and shard restarts.  Now after initialization of
shard there is no trigger for the processor to perform a DB scan.  It
now has to wait for a trigger from outside to perform the first scan so
it can start operating as usual.
This change removes the infite timer on initialize to perform first scan
immediately to check for existing timers.
Also some code cleanup and removing some unnecessary code.

fixes cadence-workflow#454
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 4a215b7 on samarabbas:timer-queue-processor-stuck-fix into ** on uber:master**.

Copy link
Contributor

@venkat1109 venkat1109 left a comment

Choose a reason for hiding this comment

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

Looks good.

timer *time.Timer // timer used to wake us up when the next message is ready to deliver
gateC chan struct{}
closeC chan struct{}
tNext, tNow int64 // time (in 'UnixNano' units) for next, (last) now and end
Copy link
Contributor

Choose a reason for hiding this comment

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

fix comment to remove "end" (or) better yet, remove the comment and rename the vars to suffix with Nanos

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 5e7b8e9 on samarabbas:timer-queue-processor-stuck-fix into ** on uber:master**.

@samarabbas samarabbas merged commit fffdc7e into cadence-workflow:master Dec 9, 2017
@samarabbas samarabbas deleted the timer-queue-processor-stuck-fix branch December 9, 2017 01:39
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.

TimerQueueProcessor requires an outside event for first query
3 participants