docs: Add signature comments to worker pool

This commit is contained in:
Alexander Navarro 2024-11-29 19:06:41 -03:00
parent f8c068a7f3
commit 837e703bc4
2 changed files with 142 additions and 76 deletions

View file

@ -37,11 +37,11 @@ func (platform *Platform) FetchCollections(fetcher Fetcher, start_pagination Pag
defer cancel()
config := &WorkConfig{
max_workers: 5,
max_retries: 2,
base_retry_time: time.Second,
rate_limit: NewRateLimit(5, time.Minute),
timeout: time.Second * 2,
amount_of_workers: 5,
max_retries: 2,
base_retry_time: time.Second,
rate_limit: NewRateLimiter(5, time.Minute),
timeout: time.Second * 2,
}
tasks := make(chan int)
@ -49,7 +49,7 @@ func (platform *Platform) FetchCollections(fetcher Fetcher, start_pagination Pag
// TODO: get number of page dynamically and change Fetcher signature
pages := 4
results, errors, done := asyncTaskRunner[int, []*Collection](ctx, tasks, config, fetchWrapper)
results, errors, done := asyncTaskRunner(ctx, tasks, config, fetchWrapper)
for i := range pages {
tasks <- i * start_pagination.Limit