unverify both on disconnect, neither on connect.
This commit is contained in:
parent
6e95ec4cec
commit
72c34f7e63
@ -158,7 +158,6 @@ export class AutoVerifier<T> {
|
||||
|
||||
// you CAN safely call this while another fetch is going on! How convenient
|
||||
unverify(): void {
|
||||
// lOG.debug(`v#${this.verifierId}: unverifying`);
|
||||
if (this.primaryPromise) {
|
||||
this.primaryPromise.catch(e => {
|
||||
console.warn('caught unverified primary promise', e);
|
||||
|
@ -198,14 +198,14 @@ export class Message implements WithEquals<Message> {
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
const channel = this.channel instanceof Channel ? this.channel.name : `ch#${this.channel.id}`;
|
||||
const member = this.member instanceof Member ? this.member.displayName : `m#${this.member.id}`;
|
||||
const channel = this.channel instanceof Channel ? this.channel.name : `ch#${this.channel.id.slice(0, 4)}`;
|
||||
const member = this.member instanceof Member ? this.member.displayName : `m#${this.member.id.slice(0, 4)}`;
|
||||
if (this.resourceName) {
|
||||
return `msg#${this.id} ${channel} @${formatDate(this.sent)} ${member}: ${
|
||||
return `msg#${this.id.slice(0, 4)} ${channel} @${formatDate(this.sent)} ${member}: ${
|
||||
this.text ? this.text + ' / ' : ''
|
||||
}${this.resourceName}`;
|
||||
} else {
|
||||
return `msg#${this.id} ${channel} @${formatDate(this.sent)} ${member}: ${this.text}`;
|
||||
return `msg#${this.id.slice(0, 4)} ${channel} @${formatDate(this.sent)} ${member}: ${this.text}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,11 +67,11 @@ export default class CombinedGuild
|
||||
// connect/Disconnect
|
||||
this.socketGuild.on('connect', () => {
|
||||
LOG.info(`g#${this.id} connected`);
|
||||
ramDiskSocket.unverify(); // make sure to query the disk-socket AutoVerifier again
|
||||
this.emit('connect');
|
||||
});
|
||||
this.socketGuild.on('disconnect', async () => {
|
||||
LOG.info(`g#${this.id} disconnected`);
|
||||
ramDiskSocket.unverify();
|
||||
diskSocket.unverify();
|
||||
await personalDB.clearAllMembersStatus(this.id);
|
||||
this.emit('disconnect');
|
||||
|
@ -558,7 +558,7 @@ function bindActionEvents(io: socketio.Server, client: socketio.Socket, identity
|
||||
const message = await DB.insertMessage(identity.guildId, channelId, identity.memberId, text);
|
||||
|
||||
LOG.info(
|
||||
`m#${message.id} ch#${message.channel_id} s@${formatDate(message.sent_dtg)} u#${message.member_id}: ${
|
||||
`g#${identity.guildId.slice(0, 4)} m#${message.id.slice(0, 4)} ch#${message.channel_id.slice(0, 4)} s@${formatDate(message.sent_dtg)} u#${message.member_id.slice(0, 4)}: ${
|
||||
message.text
|
||||
}`,
|
||||
);
|
||||
@ -596,7 +596,7 @@ function bindActionEvents(io: socketio.Server, client: socketio.Socket, identity
|
||||
resourceName = resourceName.replace(/[^A-Za-z0-9 .]/g, '_'); // only alphanumerics for file names
|
||||
|
||||
LOG.info(
|
||||
`u#${identity.memberId?.slice(0, 4)}: resource message with resource of size: ${resource.length} bytes`,
|
||||
`u#${identity.memberId.slice(0, 4)}: resource message with resource of size: ${resource.length} bytes`,
|
||||
);
|
||||
|
||||
// try to get the dimensions of the resource if it is an image so that we can scale it down for the preview
|
||||
|
Loading…
Reference in New Issue
Block a user