Skip to content

Commit

Permalink
use context if available
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Apr 1, 2024
1 parent 83b79c3 commit cc21c29
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/lmd/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (n *Nodes) checkNodeAvailability(ctx context.Context) {
waitGroup.Add(1)
go func(waitGroup *sync.WaitGroup, node *NodeAddress) {
defer n.lmd.logPanicExit()
isOnline, forceRedistribute := n.sendPing(node, initializing, requestData)
isOnline, forceRedistribute := n.sendPing(ctx, node, initializing, requestData)
if forceRedistribute {
redistribute = true
}
Expand Down Expand Up @@ -528,10 +528,9 @@ func generateUUID() (uuid string) {
return
}

func (n *Nodes) sendPing(node *NodeAddress, initializing bool, requestData map[string]interface{}) (isOnline, forceRedistribute bool) {
func (n *Nodes) sendPing(ctx context.Context, node *NodeAddress, initializing bool, requestData map[string]interface{}) (isOnline, forceRedistribute bool) {
done := make(chan bool)
ownIdentifier := n.ID
ctx := context.Background()
err := n.SendQuery(ctx, node, "ping", requestData, func(responseData interface{}) {
defer func() { done <- true }()
// Parse response
Expand Down

0 comments on commit cc21c29

Please sign in to comment.