You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: internal/service/event_listener.go
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -136,7 +136,12 @@ func (e *DBusEventListener) Listen() {
136
136
caserunning:
137
137
log.Debugf("Sending start event to observer channel for workload %s", n)
138
138
e.observerCh<-&Event{WorkloadName: n, Type: EventStarted}
139
-
caseremoved, stop, dead, failed, start:
139
+
caseremoved:
140
+
// We remove the service from the filter here to avoid a potential race condition where the fs notify routine removes it before the systemd event is received.
141
+
log.Infof("Service %s disabled or removed", name)
142
+
e.Remove(name)
143
+
fallthrough
144
+
casestop, dead, failed, start:
140
145
log.Debugf("Sending stop event to observer channel for workload %s", n)
141
146
e.observerCh<-&Event{WorkloadName: n, Type: EventStopped}
142
147
default:
@@ -165,11 +170,10 @@ func (e *DBusEventListener) watchFSEvents() {
165
170
svcName:=getServiceFileName(event.Name)
166
171
switch {
167
172
caseevent.Op&fsnotify.Create==fsnotify.Create:
168
-
log.Infof("New service configuration detected at %s", event.Name)
173
+
log.Infof("New systemd service unit file %s detected", event.Name)
169
174
e.Add(svcName)
170
175
caseevent.Op&fsnotify.Remove==fsnotify.Remove:
171
-
log.Infof("Service configuration removed at %s", event.Name)
172
-
e.Remove(svcName)
176
+
log.Debugf("Systemd service unit file %s has been removed. Waiting for the systemd dbus remove event to elimitate it from the service watch filter", event.Name)
0 commit comments