-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 the @Options#timeoutString #2886
base: master
Are you sure you want to change the base?
Add the @Options#timeoutString #2886
Conversation
Support a new attribute that specify the query timeout using configuration's variables such as ${timeout.query1}
@@ -88,8 +88,9 @@ public String handleToken(String content) { | |||
return variables.getProperty(key, defaultValue); | |||
} | |||
} | |||
if (variables.containsKey(key)) { | |||
return variables.getProperty(key); |
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.
@kazuki43zoo Just a question on this. Historically, it was suggested to check contains before getting it for some performance reason. Has that changed? I have seen recently less of doing it via containsKey.
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.
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.
学习了,看到了
@kazuki43zoo Is there any reason 'timeoutString' has to be a string instead of just an int? Other than obvious to match the XML, I'm not so certain that is necessary never mind that the XML already is 'timeout' so it more naturally would be 'timeout' to match. I realize under the hood 'timeout' is there but thinking it would be cleaner to just be 'timeout' as int. |
@hazendaz The 'timeout' as int already exists on P.S. |
Thanks for explanation! All good with this now.
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Kazuki Shimizu ***@***.***>
Sent: Saturday, June 10, 2023 6:25:58 PM
To: mybatis/mybatis-3 ***@***.***>
Cc: Jeremy Landis ***@***.***>; Mention ***@***.***>
Subject: Re: [mybatis/mybatis-3] Add the @options#timeoutString (PR #2886)
@kazuki43zoo<https://github.com/kazuki43zoo> Is there any reason 'timeoutString' has to be a string instead of just an int? Other than obvious to match the XML, I'm not so certain that is necessary never mind that the XML already is 'timeout' so it more naturally would be 'timeout' to match. I realize under the hood 'timeout' is there but thinking it would be cleaner to just be 'timeout' as int.
@hazendaz<https://github.com/hazendaz> The 'timeout' as int<https://github.com/mybatis/mybatis-3/blob/master/src/main/java/org/apache/ibatis/annotations/Options.java#L100> already exists on @options. Sometimes I want to configure a timeout using externalize configuration (e.g. k8s's ConfigMap, environmental variables, system properties, etc... ). For instance, to have a quick way to increase the timeout on a critical business operation without the code changes and keep business running. But if timeout define as int, we need build and release a new application for changing timeout. Therefore, I propose the 'timeoutString' option to improve it.
P.S.
I inspire the @transactional<https://github.com/spring-projects/spring-framework/blob/main/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java#L178-L199> of Spring Framework.
—
Reply to this email directly, view it on GitHub<#2886 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAHODI4HVPJAXYSA754PO33XKTX7NANCNFSM6AAAAAAZBQTFCE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
True, but I think this is not the designed behavior. If we were to support this, we should add a new option (e.g. |
I propose to add a new attribute that specify the query timeout using configuration's variables such as
${timeout.query1}
.There are cases that a timeout value want to specify other value per runtime environment.
timeout.query1=30
For example for using on MyBatis Spring Boot:
NOTE
Already XML mapper can use the configuration's variables as follow: