update post import

This commit is contained in:
April John 2023-05-24 20:21:15 +02:00
parent 2ce76a7097
commit 208c7d380a
3 changed files with 10 additions and 3 deletions

View File

@ -19,6 +19,8 @@ export function initialize<T>(name: string, limitPerSec = -1) {
}
: undefined,
settings: {
stalledInterval: 60,
maxStalledCount: 2,
backoffStrategies: {
apBackoff,
},

View File

@ -20,9 +20,11 @@ export async function importMastoPost(
}
const post = job.data.post;
let reply: Note | null = null;
job.progress(20);
if (post.object.inReplyTo != null) {
reply = await resolveNote(post.object.inReplyTo);
}
job.progress(40);
if (post.directMessage) {
done();
return;
@ -33,13 +35,14 @@ export async function importMastoPost(
return;
}
}
job.progress(60);
let text;
try {
text = htmlToMfm(post.object.content, post.object.tag);
} catch (e) {
throw e;
}
job.progress(80);
const note = await create(user, {
createdAt: new Date(post.object.published),
files: undefined,
@ -56,6 +59,8 @@ export async function importMastoPost(
apHashtags: undefined,
apEmojis: undefined,
});
logger.succ("Imported");
job.progress(100);
done();
logger.succ("Imported");
}

View File

@ -20,7 +20,7 @@ export const inboxQueue = initializeQueue<InboxJobData>(
"inbox",
config.inboxJobPerSec || 16,
);
export const dbQueue = initializeQueue<DbJobData>("db");
export const dbQueue = initializeQueue<DbJobData>("db", 256);
export const objectStorageQueue =
initializeQueue<ObjectStorageJobData>("objectStorage");
export const webhookDeliverQueue = initializeQueue<WebhookDeliverJobData>(