Skip to content

Commit

Permalink
Accept a default value for polling delay
Browse files Browse the repository at this point in the history
Default to 30 seconds if the freq is its zero-value.
  • Loading branch information
jhendrixMSFT committed Oct 21, 2021
1 parent 84308db commit 96906b6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sdk/azcore/internal/pollers/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,12 @@ func (l *Poller) FinalResponse(ctx context.Context, respType interface{}) (*http
// PollUntilDone will handle the entire span of the polling operation until a terminal state is reached,
// then return the final HTTP response for the polling operation and unmarshal the content of the payload
// into the respType interface that is provided.
// freq - the time to wait between polling intervals if the endpoint doesn't send a Retry-After header.
// A good starting value is 30 seconds. Note that some resources might benefit from a different value.
// freq - the time to wait between intervals in absence of a Retry-After header. Pass zero to accept the
// default value (30 seconds). Note that some resources might benefit from a different value.
func (l *Poller) PollUntilDone(ctx context.Context, freq time.Duration, respType interface{}) (*http.Response, error) {
if freq == 0 {
freq = 30 * time.Second
}
start := time.Now()
logPollUntilDoneExit := func(v interface{}) {
log.Writef(log.EventLRO, "END PollUntilDone() for %T: %v, total time: %s", l.lro, v, time.Since(start))
Expand Down

0 comments on commit 96906b6

Please sign in to comment.