-
Notifications
You must be signed in to change notification settings - Fork 67
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 the operation timeout is not honored for GetSchema requests #383
Fix the operation timeout is not honored for GetSchema requests #383
Conversation
There are other requests that don't honor the operation timeout as well. In future, we might refactor the logic to send any request with a timeout like: sendRequest(request, timeout).thenApply(response -> handleXxx(response.getXxxResponse()); |
The main branch is broken. I pushed a PR to fix: #384 |
616a120
to
8858744
Compare
lib/RetryableOperationCache.h
Outdated
@@ -40,8 +41,8 @@ class RetryableOperationCache : public std::enable_shared_from_this<RetryableOpe | |||
explicit PassKey() {} | |||
}; | |||
|
|||
RetryableOperationCache(ExecutorServiceProviderPtr executorProvider, int timeoutSeconds) | |||
: executorProvider_(executorProvider), timeoutSeconds_(timeoutSeconds) {} | |||
RetryableOperationCache(ExecutorServiceProviderPtr executorProvider, std::chrono::nanoseconds timeoutMs) |
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.
is this nanoseconds
or milliseconds
?
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.
Oh the name is wrong. It should be nanoseconds. I will address it
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.
I removed all Ms
or Seconds
prefixes and use TimeDuration
as the type now, PTAL again.
Fixes apache#357 ### Motivation In `Client::getSchemaInfoAsync`, the underlying `LookupService::getSchema` is called, which does not register a timer according to the operation timeout. ### Modifications Register a timer and cache it and the GetSchema promise in `ClientConnection::pendingGetSchemaRequests_`, then remove the entry and complete the promise with `ResultTimeout`. To verify the timeout is honored, modify the timeout type from `int` to `chrono::nanoseconds` so that a smaller timeout can be configured. Then test a small enough timeout (1 ns) in `LookupServiceTest.testGetSchemaTimeout`.
8858744
to
25bd34b
Compare
Fixes #357
Motivation
In
Client::getSchemaInfoAsync
, the underlyingLookupService::getSchema
is called, which does not register a timer according to the operation timeout.Modifications
Register a timer and cache it and the GetSchema promise in
ClientConnection::pendingGetSchemaRequests_
, then remove the entry and complete the promise withResultTimeout
.To verify the timeout is honored, modify the timeout type from
int
tochrono::nanoseconds
so that a smaller timeout can be configured. Then test a small enough timeout (1 ns) inLookupServiceTest.testGetSchemaTimeout
.