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
This call returns nearly immediately in most cases, when dbus and systemd is reachable.
But the jobComplete signal is only received after the system job is finished, which can take more time.
So the jobListener should be removed after the context is finished.
Like this:
if ch != nil {
c.jobListener.jobs[p] = ch
go func(ctx context.Context, p dbus.ObjectPath) {
<-ctx.Done()
c.jobListener.Lock()
defer c.jobListener.Unlock()
_, ok := c.jobListener.jobs[p]
if !ok {
return
}
fmt.Println("delete job listener after context is done")
delete(c.jobListener.jobs, dbus.ObjectPath(p))
}(ctx, p)
}
But this not ideal, because it creates a go function for each call.
The text was updated successfully, but these errors were encountered:
j-licht
added a commit
to j-licht/go-systemd
that referenced
this issue
Oct 13, 2023
Oberserve the given context from the function e.g. StartUnitContext,
which are using the internal function startJob. If this context is done
remove the job Listener if existing.
Fixescoreos#428
Conn.StartUnitContext, which actually calls internally startJob uses the given context only for the dbus call but not for the job listener.
go-systemd/dbus/methods.go
Line 61 in d843340
This call returns nearly immediately in most cases, when dbus and systemd is reachable.
But the jobComplete signal is only received after the system job is finished, which can take more time.
So the jobListener should be removed after the context is finished.
Like this:
But this not ideal, because it creates a go function for each call.
The text was updated successfully, but these errors were encountered: