Skip to content

Commit

Permalink
Stub adapter methods for async adapter
Browse files Browse the repository at this point in the history
So that it doesn't crash when started for an app using the async adapter
in development.

Closes #32
  • Loading branch information
rosa committed Nov 6, 2024
1 parent ce2160a commit 1119b8e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
49 changes: 49 additions & 0 deletions lib/active_job/queue_adapters/async_ext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module ActiveJob::QueueAdapters::AsyncExt
include MissionControl::Jobs::Adapter

# List of filters supported natively. Non-supported filters are done in memory.
def supported_job_filters(jobs_relation)
[]
end

def supports_queue_pausing?
false
end

def queues
[]
end

def queue_size(*)
0
end

def clear_queue(*)
end

def jobs_count(*)
0
end

def fetch_jobs(*)
[]
end

def retry_all_jobs(*)
end

def retry_job(job, *)
end

def discard_all_jobs(*)
end

def discard_job(*)
end

def dispatch_job(*)
end

def find_job(*)
end
end
2 changes: 1 addition & 1 deletion lib/mission_control/jobs/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Engine < ::Rails::Engine
ActiveJob::QueueAdapters::SolidQueueAdapter.prepend ActiveJob::QueueAdapters::SolidQueueExt
end

ActiveJob::QueueAdapters::AsyncAdapter.include MissionControl::Jobs::Adapter
ActiveJob::QueueAdapters::AsyncAdapter.include ActiveJob::QueueAdapters::AsyncExt
end

config.after_initialize do |app|
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Application < Rails::Application
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")

# Mission Control supported adapters
config.mission_control.jobs.adapters = [ :resque, :solid_queue ]
# Mission Control configured adapters
config.mission_control.jobs.adapters = [ :resque, :solid_queue, :async ]
end
end

0 comments on commit 1119b8e

Please sign in to comment.