Skip to content

Commit

Permalink
chore: poller no delay 1st time
Browse files Browse the repository at this point in the history
  • Loading branch information
fracasula committed Dec 10, 2024
1 parent 2ae67b0 commit b355760
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions poller/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit b355760

Please sign in to comment.