mirror of git://bitreich.org/reed-alert
Correctly report the previous success state
This commit is contained in:
parent
9698c24926
commit
fd80ed68f6
|
@ -121,11 +121,11 @@
|
||||||
(delete-file filepath))
|
(delete-file filepath))
|
||||||
|
|
||||||
;; it was a failure and then it's back to normal state
|
;; it was a failure and then it's back to normal state
|
||||||
(when triggered-before?
|
(if triggered-before?
|
||||||
|
(progn
|
||||||
(uiop:run-program (trigger-alert level fonction params t 'success) :output t)
|
(uiop:run-program (trigger-alert level fonction params t 'success) :output t)
|
||||||
(setf previous-state nil))
|
(setf previous-state nil))
|
||||||
;; in any case we return t because it's ok
|
(setf previous-state t)))
|
||||||
t)
|
|
||||||
|
|
||||||
;; FAILURE HANDLING
|
;; FAILURE HANDLING
|
||||||
(let ((trigger-now? (or
|
(let ((trigger-now? (or
|
||||||
|
@ -152,7 +152,11 @@
|
||||||
level fonction (format nil "~{~A ~}" params)
|
level fonction (format nil "~{~A ~}" params)
|
||||||
(if previous-state "SUCCESS" "ERROR")
|
(if previous-state "SUCCESS" "ERROR")
|
||||||
(if current-state "SUCCESS" "ERROR")
|
(if current-state "SUCCESS" "ERROR")
|
||||||
trigger-state (+ 1 tries)))
|
trigger-state
|
||||||
|
;; use tries variable only if previous errors
|
||||||
|
(if previous-state
|
||||||
|
0
|
||||||
|
(+ 1 tries))))
|
||||||
current-state))
|
current-state))
|
||||||
|
|
||||||
;; abort when using ctrl+c instead of dropping to debugger
|
;; abort when using ctrl+c instead of dropping to debugger
|
||||||
|
|
Loading…
Reference in New Issue