Skip to content

Commit

Permalink
fix: bulkwriter documentation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwarajanand committed Aug 30, 2022
1 parent 9327642 commit 956361a
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Firestore/src/BulkWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ public function flush($waitForRetryableFailures = false)
/**
* Reschedule failed mutations if retryable.
*
* @param int $writesId Sequence of mutation among all enqueued writes.
* @param int $lastRunStatusCode
* @param int $writesId Sequence of mutation among all enqueued writes
* @param int $lastRunStatusCode Previous status code of batchWrite
* @return void
*/
private function handleSendbatchFailure(int $writesId, int $lastRunStatusCode)
private function handleSendbatchFailure($writesId, $lastRunStatusCode)
{
if ($lastRunStatusCode === Code::OK) {
return;
Expand Down Expand Up @@ -754,7 +754,14 @@ public function close()
return $this->finalResponse;
}

public function getBackoffDuration(int $lastStatus, $backoffDurationInMillis = 0)
/**
* Gets updated backoff duration provided last status code and backoff duration.
*
* @param int $lastStatus Previous status code of batchWrite
* @param int $backoffDurationInMillis Previous backoff duration in milliseconds
* @return int
*/
public function getBackoffDuration($lastStatus, $backoffDurationInMillis = 0)
{
if ($lastStatus === Code::RESOURCE_EXHAUSTED) {
$backoffDurationInMillis = $this->maxDelayTime;
Expand Down Expand Up @@ -1376,7 +1383,13 @@ private function checkWriterConditions($document)
$this->unique_documents[] = $document;
}

private function applyJitter(int $backoffMs)
/**
* Applies jitter to backoff duration.
*
* @param int $backoffMs The backoff duration in milliseconds.
* @return int Jittered backoff duration in milliseconds.
*/
private function applyJitter($backoffMs)
{
if ($backoffMs <= 0) {
return 0;
Expand Down

0 comments on commit 956361a

Please sign in to comment.