simplify protocol for watchers of service output directories
Previously: the service wrote a timestamp and the receiver read and parsed it to see if there was new data Now: the service writes and removes a .lock file to prevent the receiver reading partial data. The receiver is responsible for remembering the *previous* state and only updating if it's changed
This commit is contained in:
@@ -56,8 +56,9 @@
|
||||
"unbound" false
|
||||
"stopped" false
|
||||
_ true)]
|
||||
(write-value "last-update" (tostring (os.time)))
|
||||
(write-value ".lock" (tostring (os.time)))
|
||||
(write-value "ifname" ifname)
|
||||
(write-value "state" state)
|
||||
(os.remove (.. state-directory "/.lock"))
|
||||
(when ready
|
||||
(with-open [fd (io.open "/proc/self/fd/10" :w)] (fd:write "\n"))))
|
||||
|
Reference in New Issue
Block a user