Skip to content

Improve database resource management and IPC input handling#578

Open
RohitKattimani wants to merge 1 commit into
666ghj:mainfrom
RohitKattimani:main
Open

Improve database resource management and IPC input handling#578
RohitKattimani wants to merge 1 commit into
666ghj:mainfrom
RohitKattimani:main

Conversation

@RohitKattimani
Copy link
Copy Markdown

Description

This PR addresses a potential resource leak and improves the robustness of the IPC command handling. These changes are non-breaking and maintain the existing simulation logic while improving overall stability.

Changes Made

  • Ensured Database Connection Closure: Modified _get_interview_result to use a finally block for conn.close(). This ensures that the database connection is always released, even if json.loads or a cursor operation throws an exception, preventing silent file descriptor leaks.
  • Defensive Dictionary Access: Added a default value of 0 when retrieving agent_id in handle_batch_interview. This standardizes behavior with the existing handle_interview method and prevents potential NoneType errors if a command is sent with a missing key.

Testing

  • Confirmed that the database still correctly retrieves and parses JSON results for interviews.
  • Verified that batch interview commands process correctly even if optional fields are missing.

Ensure agent_id defaults to 0 and close connection safely.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant