Skip to content

oncetask: WithPollInterval option for consumer-loop poll cadence - #22

Merged
anish749 merged 2 commits into
mainfrom
oncetask/configurable-poll-interval
May 17, 2026
Merged

oncetask: WithPollInterval option for consumer-loop poll cadence#22
anish749 merged 2 commits into
mainfrom
oncetask/configurable-poll-interval

Conversation

@anish749

Copy link
Copy Markdown
Owner

Problem

The consumer-loop idle-poll interval was hardcoded to 1 minute (oncetask/once_task_firestore.go). That puts a 1-minute floor on how late a time-readied task (waitUntil expiry, retry backoff, recurrence occurrence) can fire relative to its scheduled time. Workloads that need lower latency had no knob.

Solution

Add WithPollInterval(d time.Duration) HandlerOption. Stored on handlerConfig.PollInterval, defaults to 1 minute, non-positive values ignored. The consumer loop reads the value once at start when constructing its ticker.

Context

Per-handler option, same pattern as WithLeaseDuration / WithConcurrency. The value is read once at runLoop start — re-registration won't reset a live ticker, which matches how Concurrency already behaves (workers are spawned at registration). New-task creation continues to wake the loop immediately via evaluateChan; the poll interval only governs the time-based fallback.

@anish749
anish749 merged commit 5191133 into main May 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant