Do not wait on ack in bulksync response
The wait in bulkSyncNode was meant for bulkSync initiator. Not for responder. Fix the incorrect code which was also waiting unnecessarily on response which it will never get and will eventually time out. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
parent
91c837fd77
commit
fd72f6e318
|
@ -434,16 +434,19 @@ func (nDB *NetworkDB) bulkSyncNode(networks []string, node string, unsolicited b
|
||||||
return fmt.Errorf("failed to send a TCP message during bulk sync: %v", err)
|
return fmt.Errorf("failed to send a TCP message during bulk sync: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
startTime := time.Now()
|
// Wait on a response only if it is unsolicited.
|
||||||
select {
|
if unsolicited {
|
||||||
case <-time.After(30 * time.Second):
|
startTime := time.Now()
|
||||||
logrus.Errorf("Bulk sync to node %s timed out", node)
|
select {
|
||||||
case <-ch:
|
case <-time.After(30 * time.Second):
|
||||||
nDB.Lock()
|
logrus.Errorf("Bulk sync to node %s timed out", node)
|
||||||
delete(nDB.bulkSyncAckTbl, node)
|
case <-ch:
|
||||||
nDB.Unlock()
|
nDB.Lock()
|
||||||
|
delete(nDB.bulkSyncAckTbl, node)
|
||||||
|
nDB.Unlock()
|
||||||
|
|
||||||
logrus.Debugf("%s: Bulk sync to node %s took %s", nDB.config.NodeName, node, time.Now().Sub(startTime))
|
logrus.Debugf("%s: Bulk sync to node %s took %s", nDB.config.NodeName, node, time.Now().Sub(startTime))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue