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

Wait for index before completing package upload #2194

Merged
merged 8 commits into from
Jul 18, 2019

Conversation

rautenrieth-da
Copy link
Contributor

This PR factors out the main polling function of ApiPartyManagementService into a separate helper, and uses it from both ApiPartyManagementService and ApiPackageManagementService.

This makes sure users can immediately query new packages after the upload completed.

Fixes #2066

Copy link
Contributor

@stefanobaghino-da stefanobaghino-da left a comment

Choose a reason for hiding this comment

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

A couple of thing for you to look into, mostly minor. Otherwise LGTM. 🙂

* @param ids The IDs of the uploaded packages
* @return The result of the party allocation received originally, wrapped in a [[Future]]
*/
private def pollUntilPersisted(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it would make sense to move this in PollingUtils?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you prefer to leave it here, it may be worth to cut on the parameters and call PollingUtils.pollUntilPersisted with the actual values here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we use the same values for minWait, maxWait, and backoffProgression, we could also hard-code them inside PollingUtils.pollUntilPersisted. If we realize that we need different values for party and package checking, we can put them as parameters, but I doubt that will be the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test uses explicit values for minWait, maxWait, and backoffProgression to check whether they behave correctly, so I will leave the parameters for now.

iteration,
scheduler)
.map { numberOfAttempts =>
logger.debug(s"Party $newParty available, read after $numberOfAttempts attempt(s)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to move this to the helper function itself somehow? Would that be possible?

rautenrieth-da and others added 7 commits July 18, 2019 00:12
This makes sure users can immediately query the new
packages after the upload completed.

Fixes #2066
…x/services/admin/PollingUtils.scala

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
…x/services/admin/PollingUtils.scala

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
…x/services/admin/ApiPackageManagementService.scala

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
…x/services/admin/ApiPartyManagementService.scala

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
@rautenrieth-da rautenrieth-da force-pushed the package-upload-wait-for-index branch 2 times, most recently from 7cf3e66 to 3683099 Compare July 17, 2019 22:18
@rautenrieth-da rautenrieth-da force-pushed the package-upload-wait-for-index branch from 3683099 to 848717a Compare July 18, 2019 04:20
@rautenrieth-da rautenrieth-da merged commit 73545d4 into master Jul 18, 2019
@dasormeter dasormeter deleted the package-upload-wait-for-index branch September 4, 2019 17:43
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.

PostgresIndex: return package response after packages have been written to the database
3 participants