Sync update#74
Conversation
Signed-off-by: NeoZ666 <neoz.blockchain@gmail.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change refactors offerbook synchronization from main-thread polling to a worker-thread architecture. IPC handlers transition from Changes
Sequence Diagram(s)sequenceDiagram
participant Renderer
participant MainThread as Main Thread (api1.js)
participant Worker as Worker Thread (offerbook-worker.js)
participant Taker as Taker Instance
Renderer->>MainThread: ipcRenderer.invoke('taker:syncOfferbookAndWait')
MainThread->>MainThread: startSyncWorker(config)
MainThread->>Worker: new Worker() with config in workerData
Worker->>Worker: Load coinswap-napi & construct Taker instance
MainThread->>Renderer: Return { success, syncId }
Renderer->>Renderer: Poll getSyncStatus(syncId) every 1s
par Worker Execution
Worker->>Taker: taker.syncOfferbookAndWait()
Taker->>Taker: Perform offerbook sync
alt Sync Success
Taker-->>Worker: Resolve
Worker->>MainThread: postMessage({ type: 'completed' })
MainThread->>MainThread: Update activeSyncs & syncState.isRunning = false
else Sync Failure
Taker-->>Worker: Error
Worker->>MainThread: postMessage({ type: 'error', error })
MainThread->>MainThread: Update syncState & log error
end
and Polling Loop
loop Until completed or failed
Renderer->>MainThread: ipcRenderer.invoke('taker:getSyncStatus', syncId)
MainThread-->>Renderer: { status, ... }
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
updates the app with new sync apis
Summary by CodeRabbit