Skip to content

Commit

Permalink
NOISSUE - Fix race condition in tests (ultravioletrs#248)
Browse files Browse the repository at this point in the history
Signed-off-by: Sammy Oina <[email protected]>
  • Loading branch information
SammyOina authored Sep 20, 2024
1 parent eab3a06 commit a7caa59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions agent/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ func New(ctx context.Context, logger *slog.Logger, eventSvc events.Service, cmp
quoteProvider: quoteProvider,
}

go svc.sm.Start(ctx)
svc.sm.SendEvent(start)
svc.sm.StateFunctions[Idle] = svc.publishEvent(IdleState.String(), json.RawMessage{})
svc.sm.StateFunctions[ReceivingManifest] = svc.publishEvent(InProgress.String(), json.RawMessage{})
svc.sm.StateFunctions[ReceivingAlgorithm] = svc.publishEvent(InProgress.String(), json.RawMessage{})
Expand All @@ -101,6 +99,9 @@ func New(ctx context.Context, logger *slog.Logger, eventSvc events.Service, cmp
svc.sm.StateFunctions[Running] = svc.runComputation
svc.sm.StateFunctions[Failed] = svc.publishEvent(Failed.String(), json.RawMessage{})

go svc.sm.Start(ctx)
svc.sm.SendEvent(start)

svc.computation = cmp

svc.sm.SendEvent(manifestReceived)
Expand Down

0 comments on commit a7caa59

Please sign in to comment.