Closed H0llyW00dzZ closed 1 week ago
Hey @H0llyW00dzZ, another good idea but we'd need the changes in all the db files, not just MySQL.
Hey @H0llyW00dzZ, another good idea but we'd need the changes in all the db files, not just MySQL.
@briancbarrow, have to test later one by one for other database
Hey @H0llyW00dzZ, another good idea but we'd need the changes in all the db files, not just MySQL.
@briancbarrow, have to test later one by one for other database
I'm going to move this PR into draft until the other databases have been supported. Ping me again when it is ready.
Hey @H0llyW00dzZ, another good idea but we'd need the changes in all the db files, not just MySQL.
@briancbarrow, have to test later one by one for other database
I'm going to move this PR into draft until the other databases have been supported. Ping me again when it is ready.
I think any database driver supported database/sql
it supported to call this Close()
Hey @H0llyW00dzZ, another good idea but we'd need the changes in all the db files, not just MySQL.
@briancbarrow, have to test later one by one for other database
I'm going to move this PR into draft until the other databases have been supported. Ping me again when it is ready.
I think any database driver supported
database/sql
it supported to call thisClose()
Have you tested this that it works with the other databases?
Hey @H0llyW00dzZ, another good idea but we'd need the changes in all the db files, not just MySQL.
@briancbarrow, have to test later one by one for other database
I'm going to move this PR into draft until the other databases have been supported. Ping me again when it is ready.
I think any database driver supported
database/sql
it supported to call thisClose()
Have you tested this that it works with the other databases?
currently only Redis and MySQL, was implemented this as well for Redis and MySQL
@briancbarrow Anyway, it's possible to close the connection for any database supported by the standard library's . So, I think I'm going to implement this for MySQL
, PostgreSQL
, and SQLite
.
@briancbarrow Done, by the way. Only Redis and MongoDB are left, and they must be implemented independently because they are not supported by the standard library's.
[!NOTE] Also note that this is pretty useful when used for restarting or shutting down, because if the server or service is shut down or restarted without closing the connection, the connection will remain open and could lead to potential
deadlocks/hangs
for the database (e.g.,MySQL
,PostgreSQL
,SQLite
).
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
Problem/Feature
By implementing this
Close Database Connection
, it can be useful in scenarios such as graceful shutdown, for example, in Kubernetes (k8s).Description of Changes:
Note: By using the "log.Printf" method, it is more concise and idiomatic Go.
Checklist