Skip to content

Conversation

@spompea-cfa
Copy link
Contributor

@spompea-cfa spompea-cfa commented Oct 2, 2025

Add an environment variable SZ_CALL_TIMEOUT_SECONDS and supporting timeout logic so
that Senzing calls that continue past the timeout are abandoned (and logged as errors).
(Note that a Senzing call cannot ever actually be cancelled.) In the future we may want to
revisit / reevaluate this approach.

Also add logic to restore visibility (in SQS) to the currently-in-light message if/when the Consumer
receives a SIGINT / SIGTERM signal.

@spompea-cfa spompea-cfa requested a review from a team as a code owner October 2, 2025 20:39
@spompea-cfa spompea-cfa marked this pull request as draft October 2, 2025 20:39
@spompea-cfa spompea-cfa force-pushed the add-long-running-sz-call-handling branch from 49cac1c to 9c2b0fa Compare October 3, 2025 18:40
@spompea-cfa spompea-cfa changed the title [WIP] Add handling for long-running Senzing calls Add handling for long-running Senzing calls Oct 3, 2025
@spompea-cfa spompea-cfa marked this pull request as ready for review October 3, 2025 19:00
@jamesiarmes jamesiarmes requested a review from Copilot October 6, 2025 17:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds timeout handling for long-running Senzing calls to prevent indefinite blocking and implements graceful cleanup logic for process termination signals.

  • Introduces configurable timeout mechanism using SIGALRM to abandon Senzing calls that exceed the specified timeout
  • Updates SQS message visibility timeout to match the Senzing call timeout for better queue management
  • Adds signal handlers for SIGINT/SIGTERM to restore message visibility before process termination

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
middleware/timeout_handling.py New module implementing alarm-based timeout mechanism with custom exception
middleware/redoer.py Adds timeout wrapper around process_redo_record calls with error handling
middleware/consumer.py Adds timeout wrapper around add_record calls and signal handlers for graceful shutdown
README.md Documents the new SZ_CALL_TIMEOUT_SECONDS environment variable

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@jamesiarmes jamesiarmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I like seeing the SIGINT/SIGTERM handling.

@jamesiarmes jamesiarmes merged commit a12876e into main Oct 7, 2025
9 checks passed
@jamesiarmes jamesiarmes deleted the add-long-running-sz-call-handling branch October 7, 2025 15:34
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.

3 participants