Skip to content

Commit 081b777

Browse files
Merge pull request #6444 from oasisprotocol/martin/fix/storage-commitee-worker-teardown
go/worker/storage/committee: Fix teardown
2 parents 90f4aa9 + 9663948 commit 081b777

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

.changelog/6444.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go/worker/storage/committee: Fix worker teardown

go/worker/storage/committee/worker.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,8 @@ func (w *Worker) Serve(ctx context.Context) error { // nolint: gocyclo
10461046
fetchPool := workerpool.New("storage_fetch/" + w.commonNode.Runtime.ID().String())
10471047
fetchPool.Resize(config.GlobalConfig.Storage.FetcherCount)
10481048
defer fetchPool.Stop()
1049+
poolCtx, cancel := context.WithCancel(ctx)
1050+
defer cancel()
10491051

10501052
triggerRoundFetches := func() {
10511053
for i := lastFullyAppliedRound + 1; i <= latestBlockRound; i++ {
@@ -1096,11 +1098,8 @@ func (w *Worker) Serve(ctx context.Context) error { // nolint: gocyclo
10961098
rootType := prevRoots[i].Type
10971099
if !syncing.outstanding.contains(rootType) && syncing.awaitingRetry.contains(rootType) {
10981100
syncing.scheduleDiff(rootType)
1099-
doneCh := fetchPool.Submit(func() {
1100-
w.fetchDiff(ctx, this.Round, prevRoots[i], this.Roots[i])
1101-
})
1102-
wg.Go(func() {
1103-
<-doneCh
1101+
_ = fetchPool.Submit(func() {
1102+
w.fetchDiff(poolCtx, this.Round, prevRoots[i], this.Roots[i])
11041103
})
11051104
}
11061105
}

0 commit comments

Comments
 (0)