Feature:Notify Devs when Sidekiq is Not Running in Development (#10541)

This commit is contained in:
Molly Struve 2020-10-13 12:13:47 -05:00 committed by GitHub
parent 9e8ce4569e
commit ea969748e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base
include CachingHeaders
include ImageUploads
include VerifySetupCompleted
include DevelopmentDependencyChecks if Rails.env.development?
include Devise::Controllers::Rememberable
rescue_from ActionView::MissingTemplate, with: :routing_error

View file

@ -0,0 +1,16 @@
module DevelopmentDependencyChecks
extend ActiveSupport::Concern
included do
before_action :verify_sidekiq_running, only: %i[index show], if: proc { Rails.env.development? }
end
private
def verify_sidekiq_running
return if Sidekiq::ProcessSet.new.size.positive?
flash[:global_notice] = "Sidekiq is not running and is needed for the app to function properly. \
Use bin/startup to start the application properly.".html_safe
end
end