Fix own profile disappearing after failed relay fetch#426
Merged
benthecarman merged 1 commit intosledtools:masterfrom Mar 4, 2026
Merged
Fix own profile disappearing after failed relay fetch#426benthecarman merged 1 commit intosledtools:masterfrom
benthecarman merged 1 commit intosledtools:masterfrom
Conversation
When `fetch_metadata` returns `None` (relay unreachable or timeout), `apply_my_profile_metadata` was creating an empty `ProfileCache` with `event_created_at = now_seconds()`. Because `now_seconds()` is always newer than the cached event timestamp, `upsert_profile` would overwrite the good cached data with empty data, making the profile vanish. This became more frequent after the `subs_force_reconnect` change which disconnects relay WebSockets on foreground — creating a race where the concurrent profile fetch hits a disconnected relay and gets `None`. Skip the `upsert_profile` call when metadata is `None` so the existing cached profile is preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA bug fix is implemented in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
Summary
fetch_metadatareturnsNone(relay unreachable/timeout),apply_my_profile_metadatawas overwriting the cached profile with empty data because it usednow_seconds()asevent_created_at, which is always newer than the real cached timestampsubs_force_reconnectchange (disconnects WebSockets on foreground) made this more frequent by creating a race between the relay disconnect and the concurrent profile fetchupsert_profilewhen metadata isNone, preserving the existing cached profileTest plan
apply_my_profile_none_metadata_preserves_cached_profiletest🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests