Repository navigation
Conversation
|
|
||
| // cleanupTimeout returns a timeout for releasing server-side resources after the | ||
| // user's request has finished. | ||
| func cleanupTimeout() time.Duration { |
Code coverage overviewLanguages: Go Go / code-coverage/gotest
View coverage of the 9 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
| timeout = 5 * time.Second | ||
| timeout = cleanupTimeout() |
There was a problem hiding this comment.
This timeout is used to enable and disable server cancellation during normal request processing, not just during cleanup. There is already a separate CancelResetTimeout setting. I suggest keeping its five-second default independent from the new cleanup timeout.
| // concurrently with driver operations. | ||
| // The transmitted timeout must be at least 150 ms. | ||
| func SetCleanupTimeout(timeout time.Duration) error { | ||
| if timeout >= 150*time.Millisecond { |
There was a problem hiding this comment.
Why is the minimum timeout 150 ms? If the driver requires this limit, please explain why. Otherwise, I suggest accepting positive durations, treating zero as the default, and returning an error for negative values.
| @@ -0,0 +1,33 @@ | |||
| package cleanupctx | |||
There was a problem hiding this comment.
Rename this file to match the naming style used in the project. We don't use camelCase for filenames in this project.
| // user's request has finished. | ||
| func cleanupContext(parent context.Context) (context.Context, context.CancelFunc) { | ||
| return context.WithTimeout(context.WithoutCancel(parent), cleanupGracePeriod) | ||
| return cleanupctx.CleanupContext(parent) |
There was a problem hiding this comment.
This helper is also used in Batch.Execute to commit a successful batch in autocommit mode. Changing the cleanup timeout now also changes how long that commit can wait, even though no error has occurred. I suggest keeping the existing five-second timeout for this commit separate from the cleanup setting for now.
No description provided.