Skip to content

Commit 0068407

Browse files
Add some logging when restart is accepted and when a duplicate restart is ignored
Apply suggestion from @corporate-gadfly Co-authored-by: Corporate Gadfly <corporate-gadfly@users.noreply.github.com> Signed-off-by: Tim Meusel <tim@bastelfreak.de>
1 parent e548da1 commit 0068407

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/puppetlabs/trapperkeeper/internal.clj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,25 @@
113113
(defn should-handle-sighup-restart?
114114
[]
115115
(let [current-ms (now-ms)
116-
accepted? (atom false)]
116+
accepted? (atom false)
117+
previous-ms (atom nil)]
117118
(swap! last-sighup-restart-ms
118119
(fn [last-ms]
120+
(reset! previous-ms last-ms)
119121
(if (and (some? last-ms)
120122
(< (- current-ms last-ms) min-sighup-restart-interval-ms))
121123
last-ms
122124
(do
123125
(reset! accepted? true)
124126
current-ms))))
127+
(if @accepted?
128+
(log/debug (i18n/trs "Accepting SIGHUP restart at {0}; previous accepted restart was {1}"
129+
current-ms
130+
@previous-ms))
131+
(log/warn (i18n/trs "Ignoring duplicate SIGHUP restart at {0}; previous accepted restart was {1}; minimum interval is {2} ms"
132+
current-ms
133+
@previous-ms
134+
min-sighup-restart-interval-ms)))
125135
@accepted?))
126136

127137
(defn app-log-id

0 commit comments

Comments
 (0)