Skip to content

Fix Printing of session ID on close event.#56

Merged
svenvc merged 1 commit intosvenvc:masterfrom
panalcloud:fix-log-on-close
Nov 29, 2025
Merged

Fix Printing of session ID on close event.#56
svenvc merged 1 commit intosvenvc:masterfrom
panalcloud:fix-log-on-close

Conversation

@lopezca
Copy link
Copy Markdown
Contributor

@lopezca lopezca commented Nov 29, 2025

In the current implementation of P3Client>>close, the closing of the driver nullifies the session id variable and when the log tries to print it, it does not have the value. The result is that the log prints the connect and disconnect events as:

2025-11-29 11:01:11 257 [P3] 91307 #Connect psql...
2025-11-29 11:01:11 260 [P3]  #Close

moving the log printing event before calling close, allows to see the connection ID in the close event, which helps keep track of the lifetime of the connection.

2025-11-29 11:01:11 257 [P3] 91307 #Connect psql...
2025-11-29 11:01:11 260 [P3] 91307 #Close

In the current implementation, the connection close is sent inside a protected block with an empty error handler, so I think it does not matter if the log event is sent before or after. If the error handler was different, then the solution would be to create the log signal before the close command and then emit the signal after it occurred. If this is preferred, let me know and I can update the code for the PR.

@svenvc svenvc merged commit d45f0d3 into svenvc:master Nov 29, 2025
7 checks passed
@svenvc
Copy link
Copy Markdown
Owner

svenvc commented Nov 29, 2025

Thank you !

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