Module: Sidekiq::Kicks::Web

Defined in:
lib/sidekiq/kicks/web.rb

Defined Under Namespace

Classes: ScriptInjector

Constant Summary collapse

ASSETS_PATH =
File.expand_path("../../../web/assets", __dir__)

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/sidekiq/kicks/web.rb', line 62

def self.registered(app)
  app.get("/kicks/kicks.js") do
    js_content = File.read(File.join(ASSETS_PATH, "kicks.js"))
    [200, { "content-type" => "application/javascript" }, [js_content]]
  end

  app.post("/kicks/reset_processed") do
    StatsResetter.new.reset_processed
    redirect root_path.to_s
  end

  app.post("/kicks/reset_failed") do
    StatsResetter.new.reset_failed
    redirect root_path.to_s
  end
end