-
Notifications
You must be signed in to change notification settings - Fork 150
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
fix: BulkWriter: apply rate limiter before sending batch #1451
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1451 +/- ##
==========================================
- Coverage 98.22% 98.21% -0.02%
==========================================
Files 32 32
Lines 19565 19567 +2
Branches 1283 1285 +2
==========================================
Hits 19217 19217
- Misses 344 346 +2
Partials 4 4
Continue to review full report at Codecov.
|
const underRateLimit = this._rateLimiter.tryMakeRequest(batch._opCount); | ||
if (underRateLimit) { | ||
await batch.bulkCommit({requestTag: tag}); | ||
if (flush) this._scheduleCurrentBatch(flush); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This codeflow still confused me, but I now know why. This sound like it is trying to re-send the same batch again. Should we call this _scheduleNextBatch()
? FWIW, I think this function could also just be called _sendBatch()
since it takes the batch as an argument now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes more sense. Renamed.
Source-Link: googleapis/synthtool@cd78529 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:ddb19a6df6c1fa081bc99fb29658f306dd64668bc26f75d1353b28296f3a78e6
) Source-Link: googleapis/synthtool@cd78529 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:ddb19a6df6c1fa081bc99fb29658f306dd64668bc26f75d1353b28296f3a78e6
No description provided.