Skip to content

Fix blank feed race condition on cold start#117

Merged
barrydeen merged 1 commit intomainfrom
fix/cold-start-blank-feed
Mar 1, 2026
Merged

Fix blank feed race condition on cold start#117
barrydeen merged 1 commit intomainfrom
fix/cold-start-blank-feed

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • EOSE and events use separate SharedFlows in RelayPool, so after EOSE resolves the kind 3 follow list event may still be buffered in the event processing loop
  • On ~10% of cold starts, subscribeSelfData() returns before the follow list is processed, causing the feed setup to skip relay discovery and leave the user with a blank feed
  • Added a brief poll (50ms intervals, 2s cap) after EOSE to wait for the follow list to be processed before proceeding

Test plan

  • Sign in with an nsec that has an existing follow list on relays
  • Repeat 10+ times (clear app data between each) — feed should load consistently
  • Verify logcat shows subscribeSelfData: gotFollowList=true on every attempt

EOSE and events travel on separate SharedFlows, so after EOSE arrives
the kind 3 event may still be buffered waiting for the processing loop.
Poll briefly to let it catch up before the caller reads the follow list,
preventing a blank feed on ~10% of cold starts.
@barrydeen barrydeen merged commit 14be86f into main Mar 1, 2026
@barrydeen barrydeen deleted the fix/cold-start-blank-feed branch March 4, 2026 01:28
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.

1 participant