WIP
This commit is contained in:
31
src/App.ts
31
src/App.ts
@@ -77,26 +77,30 @@ export class App {
|
||||
renderTimer: ReturnType<typeof setTimeout>|null = null;
|
||||
syncQueues: Map<string, SyncItem[]> = new Map();
|
||||
syncing: Set<string> = 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 = `<span>${userID} - ${syncItems.length}</span>`;
|
||||
for (let [userID, syncItems] of this.syncQueues.entries()) {
|
||||
for (let item of syncItems) {
|
||||
let {peerID, postIDs} = item;
|
||||
let statusBarItem = `<span> checking ${postIDs.length} for user [${logID(userID)}] from peer [${logID(peerID)}]</span>`;
|
||||
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[]) {
|
||||
|
||||
@@ -44,7 +44,7 @@ export class PeerManager {
|
||||
messageSuperlog = false;
|
||||
watchdogInterval: ReturnType<typeof setTimeout> |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.
|
||||
|
||||
Reference in New Issue
Block a user