Skip to content

Commit 38cf70c

Browse files
committed
repair: add timeout GetDelta operation during repair
1 parent de0f087 commit 38cf70c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crdt.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,14 @@ func (store *Datastore) repairDAG() error {
912912
cur := nh.node
913913
head := nh.head
914914

915-
n, delta, err := getter.GetDelta(store.ctx, cur)
915+
ctx, cancel := context.WithTimeout(store.ctx, store.opts.DAGSyncerTimeout)
916+
n, delta, err := getter.GetDelta(ctx, cur)
916917
if err != nil {
918+
cancel()
917919
return errors.Wrapf(err, "error getting node for reprocessing %s", cur)
918920
}
921+
cancel()
922+
919923
isProcessed, err := store.isProcessed(cur)
920924
if err != nil {
921925
return errors.Wrapf(err, "error checking for reprocessed block %s", cur)

0 commit comments

Comments
 (0)