Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/SSM-31: added context with timeout to avoid hanging requests. #36

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

j1mb0b
Copy link
Contributor

@j1mb0b j1mb0b commented Jan 23, 2025

Purpose

Change is to fix the timeout issue in the IngestHandler function within handler.go.

Approach

To fix the timeout issue, I added a context.WithTimeout call to set a timeout duration for the HTTP call to create a stub case in Sirius. This ensures that the HTTP call does not wait indefinitely for a response, and instead returns an error if the response takes longer than the specified timeout duration.

Additionally, added the cancel() function to ensure that the context is cancelled when the function returns, but not before the CreateCaseStub call has completed.

Learning

Check my context usages properly!

Checklist

  • I have performed a self-review of my own code
  • I have added relevant logging with appropriate levels to my code
  • I have updated documentation where relevant
  • I have added tests to prove my work

@j1mb0b j1mb0b requested a review from a team as a code owner January 23, 2025 14:23
@j1mb0b j1mb0b merged commit 190ee71 into main Jan 23, 2025
14 checks passed
@j1mb0b j1mb0b deleted the feat/SSM-31 branch January 23, 2025 15:57
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