-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
add statement timeout query param for postgres #327
add statement timeout query param for postgres #327
Conversation
Pull Request Test Coverage Report for Build 648
💛 - Coveralls |
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.
Thanks for the PR!
database/postgres/postgres.go
Outdated
@@ -25,6 +26,7 @@ func init() { | |||
} | |||
|
|||
var DefaultMigrationsTable = "schema_migrations" | |||
var DefaultStatementTimeoutMs = 10000 // 10 seconds |
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.
Make this a time.Duration
as well
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.
sounds good
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.
this is actually no longer needed
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.
In other words, If the caller
- does not pass any value, we default to 0 (i.e background context)
- passes an invalid value, we return error from Atoi and abort migration
- passes valid value, we use it as the timeout value (i.e context with timeout)
Co-Authored-By: Roopak Venkatakrishnan <roopak.v@gmail.com>
96f63e8
to
87c2491
Compare
@dhui Can you give this another read? I would like to merge this soon. |
…to psuresh/postgres-statement-timeout
if statementTimeoutString != "" { | ||
statementTimeout, err = strconv.Atoi(statementTimeoutString) | ||
if err != nil { | ||
return nil, err |
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.
@dhui wondering if we should throw a custom error here instead of the Atoi one, thoughts?
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 think we'd lose information w/ a custom error, so it'd be cleaner to wrap the error using multierror
.
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.
Lemme know if you wanna wrap the Atoi()
error using multierror
and I'll hold off on merging until then.
not urgent. please go ahead and merge this when you can. |
thanks @dhui . When do you plan to make a new release? |
The earliest would be in a week so the change can be tested by people running the master branch. If you'd like to use the change, I'd use the master branch for now and change to the next release when it's available. |
Adding statement timeout option to postgres driver as a query param