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

use lua script to schedule jobs #427

Merged
merged 1 commit into from
Aug 21, 2020
Merged

Conversation

ananthakumaran
Copy link
Collaborator

The old approach had two issues

  • There was no limit on the zrangebyscore call, this could potentially
    cause memory issues if there are lot of jobs scheduled within the
    current time range.

  • The dequeue and enqueue operation is not atomic. The job could be
    lost if exq failed to enqueue the job after the zrem command either
    due to shutdown or redis connection error

The new approach uses lua script to run the dequeue and enqueue
atomically. A configurable page limit is used to avoid blocking the
redis server for long time.

fixes #318 #315

The old approach had two issues

* There was no limit on the zrangebyscore call, this could potentially
cause memory issues if there are lot of jobs scheduled within the
current time range.

* The dequeue and enqueue operation is not atomic. The job could be
lost if exq failed to enqueue the job after the zrem command either
due to shutdown or redis connection error

The new approach uses lua script to run the dequeue and enqueue
atomically. A configurable page limit is used to avoid blocking the
redis server for long time.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 91.64% when pulling e99a6ab on reliable-scheduler into 548bd9e on master.

@ananthakumaran ananthakumaran merged commit ade8398 into master Aug 21, 2020
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