From 838f5a9ff3fab1dcca9227abce9fdef10d95c97b Mon Sep 17 00:00:00 2001 From: Jonas Licht Date: Fri, 13 Oct 2023 16:06:45 +0200 Subject: [PATCH] dbus/methods: don't write blocking to jobListener channel When handling the jobComplete signal, only try to write to the channel and do not block on the channel write. If nothing reads from this channel, the function blocks forever and makes it impossible to start new jobs. Fixes #429 --- dbus/methods.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbus/methods.go b/dbus/methods.go index 10bafa9..c00a49b 100644 --- a/dbus/methods.go +++ b/dbus/methods.go @@ -45,7 +45,10 @@ func (c *Conn) jobComplete(signal *dbus.Signal) { c.jobListener.Lock() out, ok := c.jobListener.jobs[job] if ok { - out <- result + select { + case out <- result: + default: + } delete(c.jobListener.jobs, job) } c.jobListener.Unlock()