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

Mysql rerun dead jobs #6

Merged
merged 7 commits into from
Sep 19, 2022

Conversation

autotaker
Copy link
Contributor

@autotaker autotaker commented Sep 17, 2022

Closes #5

This PR implements missing feature to re-run dead jobs for MySQL backends.

Tests

I added unit tests for this feature. The scenario is the following steps.

Scenario 1

  1. Push a job
  2. Register a worker with last_seen = (6 minutes ago).
  3. Pull the job by the worker.
  4. Call heartbeat with ReenqueueOrphaned.
  5. Assert that the job status is reset to Pending.

Scenario 2

  1. Push a job
  2. Register a worker with last_seen = (4 minutes ago).
  3. Pull the job by the worker.
  4. Call heartbeat with ReenqueueOrphaned.
  5. Assert that the job status is not changed.

Other changes

  • Extracted method keep_alive_at(worker_id, last_seen) from keep_alive(worker_id) to improve testability
  • Modified the condition run_at < NOW() in stream_jobs to run_at <= NOW(), because jobs cannot be pulled immediately after pushed.
  • Added Test Suite with MySQL action to ci.yaml to execute unit tests with MySQL.

@geofmureithi geofmureithi merged commit f2e6438 into geofmureithi:develop Sep 19, 2022
@geofmureithi geofmureithi mentioned this pull request Sep 19, 2022
2 tasks
@autotaker autotaker mentioned this pull request Sep 19, 2022
4 tasks
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