Repository navigation
connector: keep contact search bounded and stop it when the request is canceled - #296
Merged
Merged
Conversation
…s canceled SearchUsers looked up every matching contact again one by one, returned every match, and kept going after the client went away. The provisioning API then synced each result's ghost, downloading avatars with a client that ignored the request context, so a short query on a large contact list ran for minutes. Cache the contacts from the batch lookup, cap name matches at 20, stop between batches once the context is done, and make avatar downloads use the request context and reject non-200 responses.
Contributor
Author
|
No issues found.
All CI checks passed on
Select any unchecked box below to run or rerun that agent. Full resultsIndent Review Agent
|
highesttt
approved these changes
Oct 29, 2026
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.
Production logs over 24 h:
search_usersp90 is 116 s and p99 819 s. Six accounts had searches over 10 s; for one, the median search took 182 s and the slowest 875 s. That account also logged about 6.7kFailed to update ghost in database after updating info: context cancelederrors and 4.6k avatar timeouts in 35 minutes, all from search requests the client had already abandoned.Cause:
SearchUsersalready gets every contact from the batchedGetContactsV2, but it then looked each match up again throughGetUserInfo, one network call per contact with a BuddyService fallback. It returned every match, and it kept going after the request context was canceled. The provisioning API then syncs each result's ghost, one after another.GetAvatarignored the context, so every avatar download kept running for up to 10 s after cancellation. It also uploaded non-200 bodies as avatars.Change:
GetAvataruse the request context and reject non-200 responses.Tag
@indentto continue the conversation here.