Skip to content

Commit

Permalink
go/worker/compute: Only process keymanager client initialization once
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrus committed Oct 4, 2022
1 parent 8771fbd commit 38b1997
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/4962.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/worker/compute: Only process keymanager client initialization once
18 changes: 13 additions & 5 deletions go/worker/compute/executor/committee/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,19 @@ func (n *Node) worker() {
// We are initialized.
close(n.initCh)

// Update availability once keymanager client initializes.
go func() {
select {
case <-n.stopCh:
n.logger.Info("termination requested")
return
case <-n.commonNode.KeyManagerClient.Initialized():
n.commonNode.CrossNode.Lock()
n.nudgeAvailabilityLocked(false)
n.commonNode.CrossNode.Unlock()
}
}()

for {
// Check if we are currently processing a batch. In this case, we also
// need to select over the result channel.
Expand Down Expand Up @@ -1572,11 +1585,6 @@ func (n *Node) worker() {
case txs := <-txCh:
// Check any queued transactions.
n.handleNewCheckedTransactions(txs)
case <-n.commonNode.KeyManagerClient.Initialized():
// Key manager client has been initialized, update availability if needed.
n.commonNode.CrossNode.Lock()
n.nudgeAvailabilityLocked(false)
n.commonNode.CrossNode.Unlock()
case <-n.reselect:
// Recalculate select set.
}
Expand Down

0 comments on commit 38b1997

Please sign in to comment.