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.
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.
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.