-
Notifications
You must be signed in to change notification settings - Fork 8
Description
The Action Queue we implemented has surfaced some pre-existing sync issues. I'm keeping track here of what I'm doing (minor fixes). I know you want to revamp sync @CassOnMars , so this is to keep you up to speed.
Ref.
In 49c19ae
.agents\docs\features\action-queue.md.agents\reports\sync-optimizations_2025-12-19.md
⚠️ AI-Generated: May contain errors. Verify before use.
This report tracks sync-related optimizations implemented in the quorum-desktop codebase. These optimizations improve message delivery latency, throughput, and reliability. The lead dev can review these changes to understand the rationale and decide whether to adopt, modify, or replace them.
Optimizations
1. WebSocket Queue Separation - 002e1a9
The WebSocketProvider.processQueue() function used a single lock (processingRef) for both inbound and outbound message processing. This caused:
- Blocking: If inbound handler hangs, outbound messages blocked indefinitely
- Artificial latency: Outbound messages wait for all inbound processing to complete
- Sequential bottleneck: Independent operations unnecessarily serialized
Before (Sequential):
Inbound processing ────────────────────> Outbound processing ────────>
[━━━━━━━━ 500ms ━━━━━━━━] [━━━━ 100ms ━━━━]
User action (send DM, edit, profile update) delayed by inbound processing time
Solution
Separate inbound and outbound into independent functions with independent locks:
const inboundProcessingRef = useRef(false);
const outboundProcessingRef = useRef(false);
const processInbound = async () => { /* inbound only */ };
const processOutbound = async () => { /* outbound only */ };After (Parallel):
Inbound processing ────────────────────>
[━━━━━━━━ 500ms ━━━━━━━━]
Outbound processing ────────> (starts immediately, no wait)
[━━━━ 100ms ━━━━]
User actions execute immediately
Sync Performance Benefits
| Metric | Before | After |
|---|---|---|
| Outbound latency | Blocked by inbound | Immediate |
| User action responsiveness | Delayed | Instant |
| Throughput during high traffic | Sequential | Parallel |
| Reliability | Single point of failure | Independent failure domains |
Verification
- feature-analyzer agent: Confirmed inbound/outbound are independent
- No hidden dependencies: WebSocket API
send()is thread-safe - Ordering preserved: Outbound FIFO maintained
Pre-existing Issue
Bug exists in develop branch since initial commit. Not caused by Action Queue, but Action Queue made it more visible by routing ALL DM sends through enqueueOutbound.
Summary Table
| # | Optimization | Status | Impact | Risk | File |
|---|---|---|---|---|---|
| 1 | WebSocket Queue Separation | Pending | High | Low | WebsocketProvider.tsx |
For Review
Decision Points
- WebSocket Queue Separation: Accept as-is, or prefer different approach?