WIP
This commit is contained in:
33
src/App.ts
33
src/App.ts
@@ -77,26 +77,30 @@ export class App {
|
|||||||
renderTimer: ReturnType<typeof setTimeout>|null = null;
|
renderTimer: ReturnType<typeof setTimeout>|null = null;
|
||||||
syncQueues: Map<string, SyncItem[]> = new Map();
|
syncQueues: Map<string, SyncItem[]> = new Map();
|
||||||
syncing: Set<string> = new Set();
|
syncing: Set<string> = new Set();
|
||||||
|
statusBar = "";
|
||||||
|
|
||||||
updateStatusBar() {
|
updateStatusBar() {
|
||||||
|
|
||||||
|
let statusBarElement = document.getElementById('status_bar');
|
||||||
|
|
||||||
|
if (!statusBarElement) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// let statusBarElement = document.getElementById('status_bar');
|
let newStatusBar = "";
|
||||||
|
|
||||||
// if (!statusBarElement) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let newStatusBar = "";
|
|
||||||
|
|
||||||
|
|
||||||
// for (let [userID, syncItems] of this.syncQueues.entries()) {
|
for (let [userID, syncItems] of this.syncQueues.entries()) {
|
||||||
// let statusBarItem = `<span>${userID} - ${syncItems.length}</span>`;
|
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) {
|
async processSyncQueue(userID: string) {
|
||||||
@@ -105,7 +109,7 @@ export class App {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateStatusBar();
|
// this.updateStatusBar();
|
||||||
|
|
||||||
let syncQueue = this.syncQueues.get(userID) as SyncItem[];
|
let syncQueue = this.syncQueues.get(userID) as SyncItem[];
|
||||||
|
|
||||||
@@ -132,9 +136,10 @@ export class App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// this.updateStatusBar();
|
||||||
this.syncing.delete(userID);
|
this.syncing.delete(userID);
|
||||||
|
|
||||||
this.updateStatusBar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addPostIDsToSyncQueue(userID: string, peerID: string, postIDs: string[]) {
|
addPostIDsToSyncQueue(userID: string, peerID: string, postIDs: string[]) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export class PeerManager {
|
|||||||
messageSuperlog = false;
|
messageSuperlog = false;
|
||||||
watchdogInterval: ReturnType<typeof setTimeout> |null = null;
|
watchdogInterval: ReturnType<typeof setTimeout> |null = null;
|
||||||
reconnectTimer: number | null = null;
|
reconnectTimer: number | null = null;
|
||||||
peerStateSuperlog: boolean = false;
|
peerStateSuperlog: boolean = true;
|
||||||
|
|
||||||
// async watchdog() {
|
// async watchdog() {
|
||||||
// // Check that we're connected to at least N peers. If not, reconnect to the bootstrap server.
|
// // Check that we're connected to at least N peers. If not, reconnect to the bootstrap server.
|
||||||
|
|||||||
Reference in New Issue
Block a user