mirror of
https://git.sr.ht/~emerson/reflectionircd
synced 2025-04-13 09:59:52 +00:00
Timestamp and clarify debug logs
This commit is contained in:
parent
540fd979fc
commit
fa58928ec2
1 changed files with 9 additions and 3 deletions
|
@ -152,14 +152,16 @@ export class IRCUser {
|
|||
|
||||
doSync(): void {
|
||||
if (!this.isSynced()) {
|
||||
console.log("not syncing, initial sync not completed");
|
||||
console.log(`[${new Date().toISOString()}] ${this.homeserver}: not syncing, initial sync not completed`);
|
||||
return;
|
||||
}
|
||||
if (this.isSyncing) {
|
||||
if ((Date.now() - this.currentSyncTime) > 20000)
|
||||
console.log(`Sync is lagging, current sync has been running for ${Date.now() - this.currentSyncTime} milliseconds`);
|
||||
console.log(`[${new Date().toISOString()}] ${this.homeserver}: Sync is lagging, current sync has been running for ${Date.now() - this.currentSyncTime} milliseconds`);
|
||||
return;
|
||||
}
|
||||
if (this.currentSyncTime === 0)
|
||||
console.log(`[${new Date().toISOString()}] ${this.homeserver}: Synced to network!`);
|
||||
this.currentSyncTime = Date.now();
|
||||
this.isSyncing = true;
|
||||
const endpoint = `https://${this.homeserver}/_matrix/client/v3/sync?access_token=${this.accessToken}&since=${this.nextBatch}&timeout=15000`;
|
||||
|
@ -178,7 +180,11 @@ export class IRCUser {
|
|||
}
|
||||
this.isSyncing = false;
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
if (error.response) {
|
||||
console.log(`[${new Date().toISOString()}] Error from ${this.homeserver}: ${error.response.status} ${error.response.statusText}`)
|
||||
} else {
|
||||
console.log(`[${new Date().toISOString()}] Error from ${this.homeserver}: ${error}`);
|
||||
}
|
||||
this.isSyncing = false;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue