Repository navigation
provider_timeout-fix: Added logic to fast fail in some additional path - #950
Open
Vinodsathyaseelan wants to merge 1 commit into
Open
Vinodsathyaseelan wants to merge 1 commit into
Vinodsathyaseelan wants to merge 1 commit into
Conversation
when provider is not for specific app or broadcast use case.
Minimum allowed line rate is |
There was a problem hiding this comment.
🔵 Needs a closer look
Two moderate issues involving stale listeners can prevent reliable fast failure.
Pull request overview
Adds fast-failure handling when no suitable provider is available, avoiding unnecessary timeouts.
Changes:
- Adds checks for app-specific and broadcast requests.
- Centralizes fast-failure responses and logging.
- Reuses fast-failure handling when no provider exists.
File summaries
| File | Summary | Findings |
|---|---|---|
core/main/src/service/apps/provider_broker.rs |
Adds provider availability checks and fast-failure responses. | Moderate (1 vote): Checks may match stale listeners rather than active provider registrations, allowing requests to wait for the timeout. Moderate (1 vote): Listener counts may include stale listeners and prevent fast failure when no provider can respond. |
Review details
Suppressed comments (2)
core/main/src/service/apps/provider_broker.rs:265
- This tests only for any listener with the target app ID, not for an active provider registration.
unregister_providerremoves the provider method but does not remove its AppEvents listener, so with another provider registered for the same method an app-specific request can pass here,emit_to_appsends to the stale/non-provider listener, and the caller still waits for the timeout. Remove provider listeners during unregister/cleanup or validate this against the active provider registration before starting the session.
if !AppEvents::is_app_registered_for_event(
pst,
app_id.clone(),
&event_name,
) {
core/main/src/service/apps/provider_broker.rs:276
- The count includes stale listeners, so it does not establish that a provider can respond. For example, after one provider unregisters (leaving its listener behind) and the currently registered provider disconnects, this remains nonzero and
emitbroadcasts to the stale listener instead of fast-failing; the caller can still wait the full timeout. Count only listeners tied to active provider registrations, or fix listener cleanup before relying on this guard.
let listener_count =
AppEvents::get_listeners(&pst.app_events_state, &event_name, None).len();
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
when provider is not for specific app or broadcast use case.
What
What does this PR add or remove?
Why
Why are these changes needed?
How
How do these changes achieve the goal?
Test
How has this been tested? How can a reviewer test it?
Checklist