Skip to content

Commit

Permalink
Start receiving from queue only once we got all inflight executions. (t…
Browse files Browse the repository at this point in the history
…hought-machine#269)

* Receive from queue after getting list of jobs.
  • Loading branch information
fische authored and Hamishpk committed Mar 7, 2024
1 parent e2bd815 commit 4634d00
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 11.6.3
--------------
* Start receiving from queue only once we got all inflight executions.
This should fix a potential data race on init.

Version 11.6.2
--------------
* Error token bucket was mistakenly consuming with `Allow()`. Refactored to make token bucket behaviour correct.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.6.2
11.6.3
2 changes: 1 addition & 1 deletion mettle/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func serve(opts grpcutil.Opts, name string, queueOpts PubSubOpts, apiURL string,
log.Notice(" %s: %s", k, strings.Join(v, ", "))
}

go srv.Receive()
if jobs, err := getExecutions(opts, apiURL, connTLS); err != nil {
log.Warningf("Failed to get inflight executions: %s", err)
} else if len(jobs) > 0 {
Expand All @@ -180,6 +179,7 @@ func serve(opts grpcutil.Opts, name string, queueOpts PubSubOpts, apiURL string,
go srv.expireJob(id)
}
}
go srv.Receive()

lis, s := grpcutil.NewServer(opts)
pb.RegisterCapabilitiesServer(s, srv)
Expand Down

0 comments on commit 4634d00

Please sign in to comment.