Skip to content

Commit

Permalink
Fix no method error in systemd service (bensheldon#1173)
Browse files Browse the repository at this point in the history
* Fix a no method error in systemd service

The ActiveSupport::Notifications instrument was called with a nil as an
error object and it was throwing a no method error up in the chain. This
is due to a missed return check.

* Update lib/good_job/systemd_service.rb

---------

Co-authored-by: Ben Sheldon [he/him] <[email protected]>
  • Loading branch information
tagrudev and bensheldon authored Dec 11, 2023
1 parent 5e9fe23 commit 381228b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/good_job/systemd_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ module GoodJob # :nodoc:
#
class SystemdService
def self.task_observer(_time, _output, thread_error) # :nodoc:
return if thread_error.is_a? Concurrent::CancelledOperationError
return if !thread_error || thread_error.is_a?(Concurrent::CancelledOperationError)

ActiveSupport::Notifications.instrument("systemd_watchdog_error.good_job", { error: thread_error })
GoodJob._on_thread_error(thread_error) if thread_error
GoodJob._on_thread_error(thread_error)
end

# Indicates whether the service is actively notifying systemd's watchdog.
Expand Down

0 comments on commit 381228b

Please sign in to comment.