Skip to content

Commit

Permalink
Add configurable current_user method (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaadow authored Sep 11, 2024
1 parent 78fd334 commit 281fa8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/clockwork_web/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def job
else
ClockworkWeb.disable(job)
end
ClockworkWeb.on_job_update.call(job: job, enable: enable, user: try(:current_user)) if ClockworkWeb.on_job_update
ClockworkWeb.on_job_update.call(job: job, enable: enable, user: try(ClockworkWeb.user_method)) if ClockworkWeb.on_job_update
redirect_to root_path
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/clockwork_web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ class << self
attr_accessor :monitor
attr_accessor :running_threshold
attr_accessor :on_job_update
attr_accessor :user_method
end
self.monitor = true
self.running_threshold = 60 # seconds
self.user_method = :current_user

def self.enable(job)
if redis
Expand Down

0 comments on commit 281fa8a

Please sign in to comment.