Skip to content

Commit

Permalink
Prevent delayed_job from taking from every queue
Browse files Browse the repository at this point in the history
Previous commit didn't work because delayed_job takes from all queues
indiscriminately unless you manually specify the QUEUES env var. There
is no way to do this based on prefix, but I've opened
collectiveidea/delayed_job#1095.

For now we'll have to keep QUEUES in sync with the jobs we have.
  • Loading branch information
glacials committed Jul 1, 2019
1 parent 671ff01 commit 4d81f81
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/jobs/broadcast_upload_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class BroadcastUploadJob < ApplicationJob
# Adding or deleting a job? Reflect the change in the QUEUES environment variable in docker-compose-production.yml.
queue_as :broadcast_upload

def perform(run)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/discover_runner_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class DiscoverRunnerJob < ApplicationJob
# Adding or deleting a job? Reflect the change in the QUEUES environment variable in docker-compose-production.yml.
queue_as :discover_runner

def perform(run)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/highlight_cleanup_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class HighlightCleanupJob < ApplicationJob
# Adding or deleting a job? Reflect the change in the QUEUES environment variable in docker-compose-production.yml.
queue_as :highlight_cleanup

def perform(highlight_suggestion)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/refresh_game_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class RefreshGameJob < ApplicationJob
# Adding or deleting a job? Reflect the change in the QUEUES environment variable in docker-compose-production.yml.
queue_as :refresh_game

def perform(game, category)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/sync_user_follows_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class SyncUserFollowsJob < ApplicationJob
# Adding or deleting a job? Reflect the change in the QUEUES environment variable in docker-compose-production.yml.
queue_as :sync_user_follows

def perform(user, twitch_user)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ x-environment:
- PATREON_CLIENT_ID
- PATREON_CLIENT_SECRET
- PATREON_WEBHOOK_SECRET
- QUEUE_PREFIX
- QUEUES=broadcast_upload,discover_runner,highlight_cleanup,refresh_game,sync_user_follows # keep this in sync with every job in app/jobs
- RACK_ENV=production
- RAILS_LOG_TO_STDOUT=true # Log to stdout so docker/docker-compose can take over logs
- RAILS_SERVE_STATIC_FILES=1
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ x-environment:
- NODE_ENV=development
- PATREON_CLIENT_ID
- PATREON_CLIENT_SECRET
- QUEUE_PREFIX=dev
- QUEUES=broadcast_upload,discover_runner,highlight_cleanup,refresh_game,sync_user_follows # this is here only to make you also update docker-compose-production.yml
- RAILS_LOG_TO_STDOUT=true # Log to stdout so docker/docker-compose can take over logs
- RAILS_ENV
- RAILS_ROOT="/app"
Expand Down

0 comments on commit 4d81f81

Please sign in to comment.