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

option for preventing DB connections leaks #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

colivi
Copy link

@colivi colivi commented Oct 15, 2017

Hi there,
Here is a small contribution that silently closes program after a given timeout (sec) has been provided as option.
This is really useful dealing with long sqlplus sessions on Oracle DB that are overloaded.
Hope that helps!
Thanks,
Charles

src/main.c Outdated
@@ -253,9 +257,20 @@ main_loop()
pass_through_filter(TAG_OUTPUT,""); /* If something is wrong with filter, get the error NOW */
set_echo(FALSE); /* This will also put the terminal in CBREAK mode */
test_main();

gettimeofday(&start_time, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using clock_gettime(CLOCK_MONOTONIC) instead gettimeofday. Using gettimeofday can result in erratic behavior if NTP decides to adjust the system clock, for example.

Copy link
Author

Choose a reason for hiding this comment

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

Right, thanks !
I was tempted to use CLOCK_MONOTONIC_RAW, but it's Linux specific

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants