From b35576017b7e108e743218a76eda9ea610c925e0 Mon Sep 17 00:00:00 2001 From: Francesco Casula Date: Tue, 10 Dec 2024 14:15:21 +0100 Subject: [PATCH] chore: poller no delay 1st time --- poller/poller.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/poller/poller.go b/poller/poller.go index bf61466..61319ed 100644 --- a/poller/poller.go +++ b/poller/poller.go @@ -71,6 +71,15 @@ func NewWorkspaceConfigsPoller[K comparable]( // Run starts polling for new workspace configs every interval. // It will stop polling when the context is cancelled. func (p *WorkspaceConfigsPoller[K]) Run(ctx context.Context) { + // Try the first time with no delay + updated, err := p.poll(ctx) + if p.onResponse != nil { + p.onResponse(updated, err) + } + if err != nil { // Log the error and retry with backoff later, no need to retry here + p.log.Errorn("failed to poll workspace configs", obskit.Error(err)) + } + for { select { case <-ctx.Done():