Add no-misused/floating-promises lint rule

This commit is contained in:
Fedor Indutny 2022-12-21 10:41:48 -08:00 committed by GitHub
parent 1a68c3db62
commit ed271d92ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
150 changed files with 1296 additions and 991 deletions

View file

@ -62,7 +62,7 @@ export async function start(options: StartOptionsType): Promise<void> {
enabled = true;
await resetAttachmentDownloadPending();
_tick();
void _tick();
}
export async function stop(): Promise<void> {
@ -133,7 +133,7 @@ export async function addJob(
await saveAttachmentDownloadJob(toSave);
_maybeStartJob();
void _maybeStartJob();
return {
...attachment,
@ -146,7 +146,7 @@ async function _tick(): Promise<void> {
clearTimeoutIfNecessary(timeout);
timeout = null;
_maybeStartJob();
void _maybeStartJob();
timeout = setTimeout(_tick, TICK_INTERVAL);
}
@ -229,13 +229,13 @@ async function _maybeStartJob(): Promise<void> {
Errors.toLogFormat(error)
);
} finally {
_maybeStartJob();
void _maybeStartJob();
}
}
};
// Note: intentionally not awaiting
postProcess();
void postProcess();
}
}
}
@ -360,7 +360,7 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
await saveAttachmentDownloadJob(failedJob);
} finally {
delete _activeAttachmentDownloadJobs[id];
_maybeStartJob();
void _maybeStartJob();
}
}
}
@ -420,7 +420,7 @@ async function _finishJob(
await removeAttachmentDownloadJob(id);
delete _activeAttachmentDownloadJobs[id];
_maybeStartJob();
void _maybeStartJob();
}
function getActiveJobCount(): number {
@ -472,7 +472,7 @@ async function _addAttachmentToMessage(
});
} finally {
if (attachment.path) {
window.Signal.Migrations.deleteAttachmentData(attachment.path);
void window.Signal.Migrations.deleteAttachmentData(attachment.path);
}
}
return;

View file

@ -9,6 +9,7 @@ import { getContactId } from '../messages/helpers';
import * as log from '../logging/log';
import * as Errors from '../types/errors';
import { deleteForEveryone } from '../util/deleteForEveryone';
import { drop } from '../util/drop';
export type DeleteAttributesType = {
targetSentTimestamp: number;
@ -67,36 +68,38 @@ export class Deletes extends Collection<DeleteModel> {
}
// Do not await, since this can deadlock the queue
targetConversation.queueJob('Deletes.onDelete', async () => {
log.info('Handling DOE for', del.get('targetSentTimestamp'));
drop(
targetConversation.queueJob('Deletes.onDelete', async () => {
log.info('Handling DOE for', del.get('targetSentTimestamp'));
const messages = await window.Signal.Data.getMessagesBySentAt(
del.get('targetSentTimestamp')
);
const targetMessage = messages.find(
m => del.get('fromId') === getContactId(m) && !m.deletedForEveryone
);
if (!targetMessage) {
log.info(
'No message for DOE',
del.get('fromId'),
const messages = await window.Signal.Data.getMessagesBySentAt(
del.get('targetSentTimestamp')
);
return;
}
const targetMessage = messages.find(
m => del.get('fromId') === getContactId(m) && !m.deletedForEveryone
);
const message = window.MessageController.register(
targetMessage.id,
targetMessage
);
if (!targetMessage) {
log.info(
'No message for DOE',
del.get('fromId'),
del.get('targetSentTimestamp')
);
await deleteForEveryone(message, del);
return;
}
this.remove(del);
});
const message = window.MessageController.register(
targetMessage.id,
targetMessage
);
await deleteForEveryone(message, del);
this.remove(del);
})
);
} catch (error) {
log.error('Deletes.onDelete error:', Errors.toLogFormat(error));
}

View file

@ -118,7 +118,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
return;
}
conversation.applyMessageRequestResponse(sync.get('type'), {
void conversation.applyMessageRequestResponse(sync.get('type'), {
fromSync: true,
});

View file

@ -208,7 +208,7 @@ export class Reactions extends Collection<ReactionModel> {
generatedMessage.id,
generatedMessage
);
targetConversation.addSingleMessage(messageToAdd);
void targetConversation.addSingleMessage(messageToAdd);
}
await message.handleReaction(reaction);

View file

@ -116,7 +116,7 @@ export class ReadSyncs extends Collection {
// onReadMessage may result in messages older than this one being
// marked read. We want those messages to have the same expire timer
// start time as this one, so we pass the readAt value through.
message.getConversation()?.onReadMessage(message, readAt);
void message.getConversation()?.onReadMessage(message, readAt);
};
if (window.startupProcessingQueue) {

View file

@ -98,7 +98,7 @@ export class ViewSyncs extends Collection {
const attachments = message.get('attachments');
if (!attachments?.every(isDownloaded)) {
queueAttachmentDownloads(message.attributes);
void queueAttachmentDownloads(message.attributes);
}
}