perf: 减少 session 显错

This commit is contained in:
Clansty 2022-03-06 19:59:28 +08:00
parent f5602f81b7
commit 1ba49b6029
No known key found for this signature in database
GPG Key ID: 05F8479BA63A8E92
2 changed files with 9 additions and 4 deletions

View File

@ -3,6 +3,8 @@ import db from '../providers/db';
import { AuthKey } from 'telegram/crypto/AuthKey';
import { getLogger } from 'log4js';
const PASS = () => 0;
export default class TelegramSession extends MemorySession {
private dbId: number;
private log = getLogger('TelegramSession');
@ -54,7 +56,8 @@ export default class TelegramSession extends MemorySession {
where: { id: this.dbId },
data: { dcId, serverAddress, port },
})
.then(e => this.log.trace('DC update result', e));
.then(e => this.log.trace('DC update result', e))
.catch(PASS);
}
set authKey(value: AuthKey | undefined) {
@ -64,7 +67,8 @@ export default class TelegramSession extends MemorySession {
where: { id: this.dbId },
data: { authKey: value?.getKey() || null },
})
.then(e => this.log.trace('authKey update result', e));
.then(e => this.log.trace('authKey update result', e))
.catch(PASS);
}
get authKey() {
@ -97,7 +101,8 @@ export default class TelegramSession extends MemorySession {
name: e[4] && e[4].toString(),
},
})
.then(e => this.log.trace('Entity update result', e));
.then(e => this.log.trace('Entity update result', e))
.catch(PASS);
}
}
}

View File

@ -301,7 +301,7 @@ export default class ConfigService {
const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId))
if(chatForUser.entity instanceof Api.Chat){
this.log.info('升级群组 ', chatForUser.id);
console.log(await chatForUser.migrate());
await chatForUser.migrate();
}
}
}