Skip to content
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

refactor tdengine store code, auto close resource #1513

Merged
merged 5 commits into from
Jan 24, 2024
Merged

Conversation

Carpe-Wang
Copy link
Contributor

@Carpe-Wang Carpe-Wang commented Jan 24, 2024

What's changed?

在解决fix #1419,发现和代码问题关系不大,就简单优化了下代码
记录所有的SQLException分别catch,然后就是把finally代码块用try-with-resources语句自动管理资源替代,目的是在出现异常时,可以更简洁地确保资源被正确关闭。

Checklist

  • I hereby agree to the terms of the HertzBeat CLA
  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@tomsun28 tomsun28 added enhancement New feature or request good first pull request Good for newcomers labels Jan 24, 2024
@tomsun28 tomsun28 changed the title Issue 1419 refactor tdengine store code, auto close resource Jan 24, 2024
Comment on lines 245 to 250
if (!serverAvailable) {
log.error("\n\t---------------TdEngine Init Failed---------------\n" +
"\t--------------Please Config Tdengine--------------\n" +
"\t----------Can Not Use Metric History Now----------\n");
return instanceValuesMap;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍 LGTM! hi,suggest put this before the connection.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I done the suggestion.

Copy link
Contributor

@tomsun28 tomsun28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tomsun28 tomsun28 merged commit 194e781 into master Jan 24, 2024
2 checks passed
@tomsun28 tomsun28 deleted the issue1419 branch January 24, 2024 11:02
tomsun28 pushed a commit that referenced this pull request Mar 9, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 9, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 9, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 10, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 10, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 11, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 11, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 11, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
tomsun28 pushed a commit that referenced this pull request Mar 11, 2024
Co-authored-by: Carpe-Wang <wangcarpe@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first pull request Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants