Skip to content

Commit

Permalink
Unlock before panicking (#1168)
Browse files Browse the repository at this point in the history
The logic of the function seems like a defer wouldn't unlock in order for that deferred function to handle updating the d.executing state.
  • Loading branch information
jackdawm authored Jul 24, 2023
1 parent a649812 commit a059d88
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/internal_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,11 @@ func (d *dispatcherImpl) newState(name string) *coroutineState {
func (d *dispatcherImpl) ExecuteUntilAllBlocked(deadlockDetectionTimeout time.Duration) (err error) {
d.mutex.Lock()
if d.closed {
d.mutex.Unlock()
panic("dispatcher is closed")
}
if d.executing {
d.mutex.Unlock()
panic("call to ExecuteUntilAllBlocked (possibly from a coroutine) while it is already running")
}
d.executing = true
Expand Down

0 comments on commit a059d88

Please sign in to comment.