From 7498d684c3242596f0945f87b290a4d497a15af9 Mon Sep 17 00:00:00 2001 From: bobbydigitales Date: Fri, 30 May 2025 19:46:43 -0700 Subject: [PATCH] WIP --- src/App.ts | 31 ++++++++++++++++++------------- src/PeerManager.ts | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/App.ts b/src/App.ts index 6b13ba8..d89fc6b 100644 --- a/src/App.ts +++ b/src/App.ts @@ -77,26 +77,30 @@ export class App { renderTimer: ReturnType|null = null; syncQueues: Map = new Map(); syncing: Set = new Set(); + statusBar = ""; updateStatusBar() { - return; - // let statusBarElement = document.getElementById('status_bar'); + let statusBarElement = document.getElementById('status_bar'); - // if (!statusBarElement) { - // return; - // } + if (!statusBarElement) { + return; + } - // let newStatusBar = ""; + let newStatusBar = ""; - // for (let [userID, syncItems] of this.syncQueues.entries()) { - // let statusBarItem = `${userID} - ${syncItems.length}`; + for (let [userID, syncItems] of this.syncQueues.entries()) { + for (let item of syncItems) { + let {peerID, postIDs} = item; + let statusBarItem = ` checking ${postIDs.length} for user [${logID(userID)}] from peer [${logID(peerID)}]`; + newStatusBar+= statusBarItem; + } - // newStatusBar+= statusBarItem; - // } + } - // statusBarElement.innerHTML = newStatusBar; + this.statusBar += newStatusBar; + statusBarElement.innerHTML = this.statusBar; } async processSyncQueue(userID: string) { @@ -105,7 +109,7 @@ export class App { return; } - this.updateStatusBar(); + // this.updateStatusBar(); let syncQueue = this.syncQueues.get(userID) as SyncItem[]; @@ -132,9 +136,10 @@ export class App { } } + + // this.updateStatusBar(); this.syncing.delete(userID); - this.updateStatusBar(); } addPostIDsToSyncQueue(userID: string, peerID: string, postIDs: string[]) { diff --git a/src/PeerManager.ts b/src/PeerManager.ts index e126a90..78dd64c 100644 --- a/src/PeerManager.ts +++ b/src/PeerManager.ts @@ -44,7 +44,7 @@ export class PeerManager { messageSuperlog = false; watchdogInterval: ReturnType |null = null; reconnectTimer: number | null = null; - peerStateSuperlog: boolean = false; + peerStateSuperlog: boolean = true; // async watchdog() { // // Check that we're connected to at least N peers. If not, reconnect to the bootstrap server.