From b6026ffa8ec439ab12a452955c90c03a71b26804 Mon Sep 17 00:00:00 2001 From: jumpeiMano Date: Mon, 7 Dec 2020 21:22:47 +0900 Subject: [PATCH] tweak: set sync-timeout Signed-off-by: jumpeiMano Signed-off-by: Kingdon Barrett --- pkg/daemon/sync.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/daemon/sync.go b/pkg/daemon/sync.go index 6807a0edd..5d79c04fc 100644 --- a/pkg/daemon/sync.go +++ b/pkg/daemon/sync.go @@ -45,6 +45,9 @@ type changeSet struct { // Sync starts the synchronization of the cluster with git. func (d *Daemon) Sync(ctx context.Context, started time.Time, newRevision string, rat ratchet) error { + ctx, cancel := context.WithTimeout(ctx, d.SyncTimeout) + defer cancel() + // Load last-synced resources for comparison lastResources, err := d.getLastResources(ctx, rat) if err != nil {