Skip to content

Commit

Permalink
fix: Reduce timeout of waiting in queue from 15 minutes to 5 minutes …
Browse files Browse the repository at this point in the history
…and rephrase the log a bit (#2084)

* feat: add public api to stream writer to set the maximum wait time

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* modify back the readme change from owl post processor

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: Reduce the timeout to 5 minutes for the requests wait time in queue.

Since in write api server side we have total timeout of 2 minutes, it
does not make sense to wait 15 minutes to determine whether we have met
dead connection, let's reduce the timeout here

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
GaoleMeng and gcf-owl-bot[bot] authored Apr 25, 2023
1 parent 4fc8286 commit fe25f38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.12.0')
implementation platform('com.google.cloud:libraries-bom:26.13.0')
implementation 'com.google.cloud:google-cloud-bigquerystorage'
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ConnectionWorker implements AutoCloseable {
* We will constantly checking how much time we have been waiting for the next request callback
* if we wait too much time we will start shutting down the connections and clean up the queues.
*/
static Duration MAXIMUM_REQUEST_CALLBACK_WAIT_TIME = Duration.ofMinutes(15);
static Duration MAXIMUM_REQUEST_CALLBACK_WAIT_TIME = Duration.ofMinutes(5);

private Lock lock;
private Condition hasMessageInWaitingQueue;
Expand Down Expand Up @@ -321,7 +321,7 @@ public void run() {
}

private void resetConnection() {
log.info("Reconnecting for stream:" + streamName + " id: " + writerId);
log.info("Start connecting stream: " + streamName + " id: " + writerId);
if (this.streamConnection != null) {
// It's safe to directly close the previous connection as the in flight messages
// will be picked up by the next connection.
Expand All @@ -344,7 +344,7 @@ public void run(Throwable finalStatus) {
doneCallback(finalStatus);
}
});
log.info("Reconnect done for stream:" + streamName + " id: " + writerId);
log.info("Finish connecting stream: " + streamName + " id: " + writerId);
}

/** Schedules the writing of rows at given offset. */
Expand Down

0 comments on commit fe25f38

Please sign in to comment.