Database connection management #253
Labels
No labels
bug
config update
documentation
duplicate
enhancement
in dev
input needed
new feature
not in draft
refactor
waiting on docs update
wont-do
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Sirdog/EnduraBot#253
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
During a code review executed by Claude Opus 4.6, it advised that I have many open connections, that the channel link commands create database connections per command execution, and that I never close them.
Need to refactor to have more proper database connection handling.
Alright. Some work has been done, and I've got a roadmap.
For ALL classes
Ensure that in the
__init__that the connection is closed once the table is created (if necessary).Short lived?
Add a
__enter__and__exit__method to the file.Then use
with CLASS_NAME as db:to make checks with it. Eliminate all instances of declaring the relevant class at the top of files or commands.Long lived?
Initiate the connection at bot start via
main.py.Then call the connection using
self.botwherever it is needed.Addressed by #261. Documentation updated. Closing.