Skip to content

Commit

Permalink
fix 取得してから待機
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyoichi committed Sep 17, 2024
1 parent 5c77ade commit 3c14135
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ type result interface {
func (c *Client[T]) IterRequest(ctx context.Context, uriIter iter.Seq[string]) iter.Seq2[T, error] {
return func(yield func(T, error) bool) {
for uri := range uriIter {
var val = c.NewResultFunc()
err := requestApi(c.HttpClient, uri, val)
if ok := yield(val, err); !ok {
return
}
select {
case <-ctx.Done():
return
case <-time.After(c.Interval):
var val = c.NewResultFunc()
err := requestApi(c.HttpClient, uri, val)
if ok := yield(val, err); !ok {
return
}
}
}
}
Expand Down

0 comments on commit 3c14135

Please sign in to comment.