Skip to content

[refactor] Remove late setting of database_connection in SessionManager#4976

Merged
bruntib merged 1 commit into
Ericsson:masterfrom
barnabasdomozi:auth_db_down
Jul 17, 2026
Merged

[refactor] Remove late setting of database_connection in SessionManager#4976
bruntib merged 1 commit into
Ericsson:masterfrom
barnabasdomozi:auth_db_down

Conversation

@barnabasdomozi

Copy link
Copy Markdown
Collaborator

During server initialization, there is a period when SessionManager's __database_connection property is None, and eventually this property is set to a proper sessionmaker object in the init function of the CCSimpleHttpServer class.

Due to this structure, it became a common pattern in the SessionManager class to add "if __database_connection" guards in the beginning of multiple functions to handle the case where the __database_connection property is still None.

In this refactor, the SessionManager object is now constructed properly with a "__database_connection". That field name was also misleading, therefore it was renamed to __config_db_sessionmaker. This change required to now construct the SessionManager object in the init method of the server class, and unfortunately, it increased the number of parameters of its constructor.

Hopefully this makes the further refactoring goal easier to separate server configuration handling from the SessionManager class.

During server initialization, there is a period when SessionManager's
__database_connection property is None, and eventually this property
is set to a proper sessionmaker object in the __init__ function of the
CCSimpleHttpServer class.

Due to this structure, it became a common pattern in the SessionManager
class to add "if __database_connection" guards in the beginning of
multiple functions to handle the case where the __database_connection
property is still None.

In this refactor, the SessionManager object is now constructed properly
with a "__database_connection". That field name was also misleading,
therefore it was renamed to __config_db_sessionmaker.
This change required to now construct the SessionManager object in
the __init__ method of the server class, and unfortunately, it
increased the number of parameters of its constructor.

Hopefully this makes the further refactoring goal easier to
separate server configuration handling from the SessionManager class.
@barnabasdomozi barnabasdomozi added this to the release 6.29.0 milestone Jul 17, 2026
@bruntib
bruntib merged commit 1d7d99d into Ericsson:master Jul 17, 2026
9 checks passed
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