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

Adds a "Discard all" button to queue show page, if there are enqueued jobs #218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matthewbjones
Copy link

Adds a Discard all button when viewing a specific queue, if that queue has any enqueued jobs.

@matthewbjones
Copy link
Author

@rosa I tried to have the "discard all jobs" test (https://github.com/rails/mission_control-jobs/pull/218/files#diff-8a8a64e1cafc6bc8a206a4f417ebddabb796e7169c0f83cb43d58a7077ba2671R11) assert that after clicking and confirming the Discard all button, that the queue show page would have 0 rows (like https://github.com/rails/mission_control-jobs/blob/main/test/system/discard_jobs_test.rb#L21) and also assert_no_text "Discard all"

However, the code blows up at https://github.com/rails/mission_control-jobs/blob/main/app/controllers/mission_control/jobs/queues_controller.rb#L14 because it seems like ActiveJob.queues no longer has the queue in it after all the jobs were discarded (a side effect of the test suite using Redis underneath?) This also prevents https://github.com/rails/mission_control-jobs/pull/218/files#diff-e99044e9fdb36c40c50af4dd65a95a136150cd6b74e7716c4463e0e64398b198R7 from using redirect_back, as the queue show page throws an exception, because the queue is suddenly missing.

I figured I would commit what I have and seek your thoughts.

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.

1 participant