Skip to content

Commit

Permalink
Only require sd_notify once
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Dec 1, 2020
1 parent bc1e8a4 commit 645d816
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/models/miq_worker/systemd_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,15 @@ def stop_systemd_unit(mode: "replace")
end

def sd_notify_started
require "sd_notify"
SdNotify.ready
sd_notify.ready
end

def sd_notify_stopping
require "sd_notify"
SdNotify.stopping
sd_notify.stopping
end

def sd_notify_watchdog
require "sd_notify"
SdNotify.watchdog
sd_notify.watchdog
end

private
Expand All @@ -139,6 +136,13 @@ def systemd
end
end

def sd_notify
@sd_notify ||= begin
require "sd_notify"
SdNotify
end
end

def service_base_name
self.class.service_base_name
end
Expand Down

0 comments on commit 645d816

Please sign in to comment.