Skip to content

[notifications] Give each HTTP request its own context #3569

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

S7evinK
Copy link
Collaborator

@S7evinK S7evinK commented May 3, 2025

Give each HTTP request its own context to avoid timing out subsequent notification requests if the first already times out.

Pull Request Checklist

notification requests if the first already times out.

Signed-off-by: Till Faelligen <[email protected]>
@S7evinK S7evinK requested a review from Copilot May 3, 2025 07:28
@S7evinK S7evinK requested a review from a team as a code owner May 3, 2025 07:28
@CLAassistant
Copy link

CLAassistant commented May 3, 2025

CLA assistant check
All committers have signed the CLA.

Copilot

This comment was marked as outdated.

@S7evinK S7evinK requested a review from Copilot May 3, 2025 07:33
Copilot

This comment was marked as outdated.

@S7evinK S7evinK requested a review from Copilot May 4, 2025 14:02
Copy link

@Copilot 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

This PR aims to give each HTTP request its own context to prevent one slow or timed-out notification from affecting subsequent requests. Key changes include:

  • Increasing the outer context timeout from 30 seconds to 5 minutes.
  • Creating individual HTTP contexts with a 30-second timeout for each HTTP notification request.
Comments suppressed due to low confidence (2)

userapi/consumers/roomserver.go:609

  • [nitpick] Consider verifying that the extended global context timeout of 5 minutes is appropriate for all scenarios, ensuring that resources are not held longer than necessary while still providing sufficient time for individual HTTP requests.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)

userapi/consumers/roomserver.go:627

  • [nitpick] Ensure that invoking httpCancel immediately after the HTTP request call consistently cleans up the context, especially if s.notifyHTTP has any asynchronous behavior.
httpCtx, httpCancel := context.WithTimeout(ctx, 30*time.Second)

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