diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-25 11:44:04 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-25 11:44:04 +0200 |
| commit | b4be281671ecfe5c1e6f831614ca1dde48522cd7 (patch) | |
| tree | 60607908ae545d32aabc08d86d22444003744d65 /internal/fsm | |
| parent | c9603e4a2ec682ca30399205ccbf533f55230ad4 (diff) | |
Client + FSM: Remove background argument from transition
This fixes a race condition reported by Go's -race flag
In the future we should use waitgroups to ensure the OAuth local listener is started before we sent the URL
Diffstat (limited to 'internal/fsm')
| -rw-r--r-- | internal/fsm/fsm.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/internal/fsm/fsm.go b/internal/fsm/fsm.go index d5957b0..198d51a 100644 --- a/internal/fsm/fsm.go +++ b/internal/fsm/fsm.go @@ -110,7 +110,7 @@ func (fsm *FSM) GoBack() { fsm.GoTransition(fsm.States[fsm.Current].BackState) } -func (fsm *FSM) GoTransitionWithData(newState FSMStateID, data interface{}, background bool) bool { +func (fsm *FSM) GoTransitionWithData(newState FSMStateID, data interface{}) bool { ok := fsm.HasTransition(newState) if ok { @@ -120,18 +120,14 @@ func (fsm *FSM) GoTransitionWithData(newState FSMStateID, data interface{}, back fsm.writeGraph() } - if background { - go fsm.StateCallback(oldState, newState, data) - } else { - fsm.StateCallback(oldState, newState, data) - } + fsm.StateCallback(oldState, newState, data) } return ok } func (fsm *FSM) GoTransition(newState FSMStateID) bool { - return fsm.GoTransitionWithData(newState, "{}", false) + return fsm.GoTransitionWithData(newState, "{}") } func (fsm *FSM) generateMermaidGraph() string { |
