mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
fix(coderd): avoid deadlock in (*logFollower).follow
(#7983)
This commit is contained in:
committed by
GitHub
parent
aa9dbf2eb3
commit
4068f70d2b
@ -318,6 +318,10 @@ func (f *logFollower) follow() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer subCancel()
|
defer subCancel()
|
||||||
|
// Move cancel up the stack so it happens before unsubscribing,
|
||||||
|
// otherwise we can end up in a deadlock due to how the
|
||||||
|
// in-memory pubsub does mutex locking on send/unsubscribe.
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
// we were provided `complete` prior to starting this subscription, so
|
// we were provided `complete` prior to starting this subscription, so
|
||||||
// we also need to check whether the job is now complete, in case the
|
// we also need to check whether the job is now complete, in case the
|
||||||
|
Reference in New Issue
Block a user