Skip to content

Fix various sync.Mutex double unlocks #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/weather/services/poller/worker.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Package poller implments a simple poller for the weather service.
Package poller implements a simple poller for the weather service.
It consists of a Pulse worker that periodically calls the weather service
to retrieve the weather forecast for given US cities.
*/
Expand Down
1 change: 0 additions & 1 deletion pool/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ func (node *Node) ackWorkerEvent(ctx context.Context, ev *streaming.Event) {
pending, ok := node.pendingEvents[key]
if !ok {
node.logger.Error(fmt.Errorf("received event %s from worker %s that was not dispatched", ack.EventID, workerID))
node.lock.Unlock()
return
}

Expand Down
5 changes: 1 addition & 4 deletions pool/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (w *Worker) stop(ctx context.Context) {
w.lock.Lock()
defer w.lock.Unlock()
if w.stopped {
w.lock.Unlock()
return
}
w.stopped = true
var err error
Expand Down Expand Up @@ -233,7 +233,6 @@ func (w *Worker) startJob(ctx context.Context, job *Job) error {
w.lock.Lock()
defer w.lock.Unlock()
if w.stopped {
w.lock.Unlock()
return fmt.Errorf("worker %q stopped", w.ID)
}
job.Worker = w
Expand All @@ -251,7 +250,6 @@ func (w *Worker) stopJob(ctx context.Context, key string) error {
w.lock.Lock()
defer w.lock.Unlock()
if w.stopped {
w.lock.Unlock()
return nil
}
if _, ok := w.jobs[key]; !ok {
Expand All @@ -270,7 +268,6 @@ func (w *Worker) notify(ctx context.Context, key string, payload []byte) error {
w.lock.Lock()
defer w.lock.Unlock()
if w.stopped {
w.lock.Unlock()
w.logger.Debug("worker stopped, ignoring notification")
return nil
}
Expand Down
Loading