Enhance lock acquisition and error handling in worker service

- Implement retry logic for acquiring file lock with a maximum of 3 attempts.
- Improve error handling for ENOENT errors by ensuring the directory exists before retrying.
- Update context injection handler to delegate to SearchRoutes, reducing code duplication and preventing "headers already sent" errors.
- Add checks for headersSent in error responses to avoid sending multiple responses.
- Log warnings when the port does not free up after shutdown, and handle forced shutdown scenarios more gracefully.
This commit is contained in:
Alex Newman
2025-12-28 14:40:36 -05:00
parent e12a30397d
commit 2d92e8a63f
4 changed files with 106 additions and 98 deletions
File diff suppressed because one or more lines are too long