Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use concurrency.ForEachJob() from new dskit #727

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

colega
Copy link
Contributor

@colega colega commented Jan 12, 2022

What this PR does:

Updates dskit to include grafana/dskit#113

Updated all usages of concurrency.ForEach() to use ForEachJob() so no type assertion is needed anymore.

Which issue(s) this PR fixes:

Follow up on #707

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Ref: grafana/dskit#113

Updated all usages of concurrency.ForEach() to use ForEachJob() so no
type assertion is needed anymore.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
compID := j.(ulidWithShardIndex).ulid
blocksToUpload := convertCompactionResultToForEachJobs(compIDs, job.UseSplitting(), jobLogger)
err = concurrency.ForEachJob(ctx, len(blocksToUpload), c.blockSyncConcurrency, func(ctx context.Context, idx int) error {
blockToUpload := blocksToUpload[idx]

uploadedBlocks.Inc()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to extend the scope of this PR but this isn't needed, we can just use len(blocksToUpload) later.

@colega colega requested a review from pstibrany January 12, 2022 10:18
@colega colega marked this pull request as ready for review January 12, 2022 10:18
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@pracucci pracucci merged commit 6eed443 into main Jan 12, 2022
@pracucci pracucci deleted the use-concurrency-for-each-job-from-new-dskit-version branch January 12, 2022 13:56
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.

2 participants