Skip to content

Handle connections from a pool #42

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

Merged
merged 4 commits into from
Oct 15, 2020

Conversation

LeonidVas
Copy link
Contributor

@LeonidVas LeonidVas commented Sep 9, 2020

Patchset includes:

  • Update connection management for connection pool
  • Change the return type of pool:close() to bool
  • Description of conn:close() and pool:close() added to README.md
  • Code cleanup

Fixed #33

ChangeLog:
Update connection management for connection pool.
Change the return type of pool:close() to bool.

@LeonidVas LeonidVas force-pushed the lvasiliev/gh-33-handle-connections-from-pool branch from 717046d to 2e10033 Compare September 9, 2020 15:41
@LeonidVas LeonidVas self-assigned this Sep 9, 2020
@LeonidVas LeonidVas force-pushed the lvasiliev/gh-33-handle-connections-from-pool branch 2 times, most recently from f9e8508 to 54e70d2 Compare September 10, 2020 08:42
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

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

Regarding 'refactoring: cleanup code'.

Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

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

Regarding 'update connection management for connection pool'.

@LeonidVas LeonidVas force-pushed the lvasiliev/gh-33-handle-connections-from-pool branch from 54e70d2 to adc3874 Compare October 6, 2020 11:31
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

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

LGTM.

Justification for code cleanup:
* To make the code easier to understand, the variable is declared
  inside the scope where it will be used.
* Remove unnecessary recheck.
If the connection belongs to a connection pool, it must be
returned to the pool when calling "close" without actually
closing the connection. All connections will be closed when
poll:close() will be called. The same behavior is used in
JDBC connection pool.
With this change, an attempt to "put" an unusable connection
is no longer valid.

Code that doesn't test anything has been removed from the tests.

Fixed #33
Before the patch pool: close () return fixed "number" == 1.
This seems to mean "no errors". So let's use the same return
type as for the connection: close (). This will be more consistent.
@LeonidVas LeonidVas force-pushed the lvasiliev/gh-33-handle-connections-from-pool branch from adc3874 to f2c9ac5 Compare October 15, 2020 13:28
@LeonidVas LeonidVas merged commit 6f785f7 into master Oct 15, 2020
@LeonidVas LeonidVas deleted the lvasiliev/gh-33-handle-connections-from-pool branch October 15, 2020 13:49
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.

Handle or forbid putting of closed connections into a pool
2 participants