Skip to main content

Module sync

Module sync 

Source
Expand description

Profile sync — priority queue, background processor, and relay fetching.

The sync queue batches profile fetches by priority (Critical → High → Medium → Low), with cache windows to avoid hammering relays. The background processor drains the queue and calls load_profile for each entry.

Platform-specific work (DB persistence, image caching) is handled by the ProfileSyncHandler trait — src-tauri provides TauriProfileSyncHandler, CLI provides a no-op or logging implementation.

Structs§

NoOpProfileSyncHandler
No-op handler for CLI/tests.
ProfileSyncQueue
Profile sync queue manager with four priority lanes.

Enums§

SyncPriority
Priority levels for profile syncing.

Traits§

ProfileSyncHandler
Callback trait for platform-specific profile sync work.

Functions§

block_user
Block a user by npub. DM events from blocked users are dropped after decryption. Group messages are stored but filtered in the UI.
clear_profile_sync_queue
Drop every queued profile-sync entry. Called by reset_session() so the long-lived start_profile_sync_processor loop doesn’t service the prior account’s contacts after an inline session swap.
get_blocked_users
Get all blocked profiles.
load_profile
Fetch a profile’s metadata and status from relays, update STATE, and notify via EventEmitter + handler callback.
queue_chat_profiles
Queue all profiles for a chat.
queue_profile_sync
Queue a single profile for syncing.
refresh_profile_now
Force immediate refresh of a profile (for user clicks).
set_nickname
Set a nickname for a profile.
start_profile_sync_processor
Background processor that continuously drains the profile sync queue.
sync_all_profiles
Sync all profiles in the system.
unblock_user
Unblock a user by npub.
update_bot_profile
Publish the current user’s profile and mark it as a bot (bot: true in the metadata). The SDK uses this so every bot it builds is tagged; human clients use update_profile.
update_profile
Update the current user’s profile metadata and broadcast to relays.
update_status
Update the current user’s status (kind 30315) and broadcast to relays.