Skip to content
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

Fix Login, Follow List Flickering, and Improve Event Handling (Inbox Model) #74

Merged
merged 15 commits into from
Feb 17, 2025

Conversation

prolic
Copy link
Collaborator

@prolic prolic commented Feb 5, 2025

Fixes and Enhancements

  • Login & UI Fixes:
    • Fixed login flow by ensuring signals fire correctly.
    • Resolved follow list flickering by improving model caching and key handling.
    • Increased connection timeout from 3s to 15s to improve relay connectivity.
    • Fixed async timing issues in login flow.
    • Improved pagination timestamp handling to prevent future-dated events.
    • Reduced events per pubkey from 2000 to 500 for better efficiency.

Subscription & Pagination Improvements

  • Implemented proper event pagination with timestamp tracking.
  • Added event deduplication across batches.
  • Fixed timestamp handling in subscription filters.
  • Improved debug logging for pagination.
  • Tracked processed event count in subscriptions.

Relay Connection Handling

  • Improved relay connection state management.
  • Fixed parsing of OK messages from relays.
  • Updated DM relay parsing and follow list updates.
  • Added correct nevent links for quoted reposts.

Refactoring & Optimizations

  • Simplified tag handling by switching to list-based tags.
  • Moved type definitions into dedicated modules (Event, Profile, Relay).
  • Updated tag parsing and generation throughout the codebase.
  • Optimized relay selection and inbox model improvements.

@prolic prolic changed the title optimize relay selection for contacts WIP - Inbox Model Improvements Feb 6, 2025
- Reduce maxRelaysPerContact from 3 to 2
- Improve relay selection logic to better balance between shared and unique relays
- When both shared and unique relays exist, select 1 shared + remaining unique
- Maintain maxRelaysPerContact limit while prioritizing relay diversity
Giftwrap events (encrypted DMs) should only be subscribed to on DM relays,
not inbox relays. Replace with appropriate subscriptions for mentions and
profile/post data.
- excludes failed relays within last N days
- Add connectWithFallback helper to handle relay connection failures
- Cache relay lists to reduce LMDB calls using getRelayListsForPubkeys
- Simplify buildRelayPubkeyMap to only use inbox relays as last resort
- Move subscription handling to dedicated SubscriptionHandler module
- Add pagination support for subscriptions
- Improve relay connection reliability with fallbacks and rebalancing
- Refactor subscription state management and event processing
- Add random relay selection from default pools
- Fix PTag parsing to handle all tag variants
- Move Main.hs to app/ directory
- Simplify subscription handling by removing redundant parameters
- Add pagination limits based on number of pubkeys
- Fix subscription cleanup to prevent premature state removal
- Use maximum timestamp instead of minimum for better event ordering
- Add proper handling of subscription state during relay updates
- Fix hasOtherSubs check in DM subscriptions
… type:

- Replace Tag constructors (ETag, PTag, etc) with list-based tags per NIP-01
- Move types into dedicated modules (Event, Profile, Relay)
- Update tag parsing/generation throughout codebase
- Simplify root/reply reference handling in UI
Improve relay connection state management, fix parsing of OK messages,
update follow list and DM relay parsing, and add proper nevent links
to quote reposts.
- Implement proper event pagination with timestamp tracking
- Add event deduplication across batches
- Fix timestamp handling in subscription filters
- Add detailed debug logging for pagination
- Track events processed count
- Fix async timing in login flow
- Reduce events per pubkey from 2000 to 500
- Fix pagination timestamp handling to avoid future dates
@prolic prolic changed the title WIP - Inbox Model Improvements Fix Login, Follow List Flickering, and Improve Event Handling (Inbox Model) Feb 17, 2025
@prolic prolic marked this pull request as ready for review February 17, 2025 23:01
@prolic prolic merged commit f594b75 into master Feb 17, 2025
2 checks passed
@prolic prolic deleted the inbox_model branch February 17, 2025 23:05
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