From df9aea18f584be8d8d575b5f601fa8c90f637f06 Mon Sep 17 00:00:00 2001 From: juligasa <11684004+juligasa@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:03:03 +0200 Subject: [PATCH] fix lower syncing timeout and make it configurable Remove the hardcoded 5 minutes timeout and make it 2 by default which should be more than enough. THe user can change it setting the appropriate daemon flag Former-commit-id: 458ef9fdf8506ec8510aed44d6845b3f86906fee --- backend/config/config.go | 2 +- backend/syncing/syncing.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/config/config.go b/backend/config/config.go index f2bd7b98b5..620a3c0c00 100644 --- a/backend/config/config.go +++ b/backend/config/config.go @@ -38,7 +38,7 @@ func Default() Config { Syncing: Syncing{ WarmupDuration: time.Minute, Interval: time.Minute, - TimeoutPerPeer: time.Minute * 5, + TimeoutPerPeer: time.Minute * 2, }, } } diff --git a/backend/syncing/syncing.go b/backend/syncing/syncing.go index b3e557453c..f526a1bdfc 100644 --- a/backend/syncing/syncing.go +++ b/backend/syncing/syncing.go @@ -240,7 +240,7 @@ func (s *Service) Sync(ctx context.Context) (res SyncResult, err error) { go func(i int, dev vcssql.DevicesListResult) { defer wg.Done() - ctx, cancel := context.WithTimeout(ctx, time.Minute*5) + ctx, cancel := context.WithTimeout(ctx, s.peerSyncTimeout) defer cancel() did := cid.NewCidV1(core.CodecDeviceKey, dev.DevicesMultihash)