Backfill improvements
This commit is contained in:
@@ -364,16 +364,6 @@ async function runDownloadAttachmentJob({
|
|||||||
try {
|
try {
|
||||||
log.info(`${logId}: Starting job`);
|
log.info(`${logId}: Starting job`);
|
||||||
|
|
||||||
if (
|
|
||||||
job.source !== AttachmentDownloadSource.BACKFILL &&
|
|
||||||
isPermanentlyUndownloadableWithoutBackfill(job.attachment)
|
|
||||||
) {
|
|
||||||
// We should only get to here only if
|
|
||||||
throw new AttachmentPermanentlyUndownloadableError(
|
|
||||||
'Not downloadable without backfill'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await runDownloadAttachmentJobInner({
|
const result = await runDownloadAttachmentJobInner({
|
||||||
job,
|
job,
|
||||||
abortSignal: options.abortSignal,
|
abortSignal: options.abortSignal,
|
||||||
@@ -576,6 +566,16 @@ export async function runDownloadAttachmentJobInner({
|
|||||||
{ type: attachmentType }
|
{ type: attachmentType }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
job.source !== AttachmentDownloadSource.BACKFILL &&
|
||||||
|
isPermanentlyUndownloadableWithoutBackfill(job.attachment)
|
||||||
|
) {
|
||||||
|
// We should only get to here only if
|
||||||
|
throw new AttachmentPermanentlyUndownloadableError(
|
||||||
|
'Not downloadable without backfill'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { downloadPath } = attachment;
|
const { downloadPath } = attachment;
|
||||||
let totalDownloaded = 0;
|
let totalDownloaded = 0;
|
||||||
|
@@ -100,7 +100,7 @@ export class AttachmentBackfill {
|
|||||||
timestamp,
|
timestamp,
|
||||||
response,
|
response,
|
||||||
}: AttachmentBackfillResponseSyncEvent): Promise<void> {
|
}: AttachmentBackfillResponseSyncEvent): Promise<void> {
|
||||||
const logId = `onAttachmentBackfillResponseSync(${timestamp})`;
|
let logId = `onAttachmentBackfillResponseSync(${timestamp})`;
|
||||||
if (!isBackfillEnabled()) {
|
if (!isBackfillEnabled()) {
|
||||||
log.info(`${logId}: disabled`);
|
log.info(`${logId}: disabled`);
|
||||||
return;
|
return;
|
||||||
@@ -129,6 +129,7 @@ export class AttachmentBackfill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const message = window.MessageCache.register(new MessageModel(attributes));
|
const message = window.MessageCache.register(new MessageModel(attributes));
|
||||||
|
logId += `(${message.get('sent_at')})`;
|
||||||
|
|
||||||
const timer = this.#pendingRequests.get(message.id);
|
const timer = this.#pendingRequests.get(message.id);
|
||||||
if (timer != null) {
|
if (timer != null) {
|
||||||
|
Reference in New Issue
Block a user