Skip to content

Commit 0ad445a

Browse files
committed
fix(daemon): propagate job priority
1 parent 4ada8f8 commit 0ad445a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

apps/daemon/src/jobs.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ export async function execute(job: Job, stream: Stream) {
2626
);
2727
await Promise.all(
2828
discussions.map(({ id, replyCount }) =>
29-
queueJob({
30-
type: "discuss",
31-
id: String(id),
32-
page: replyCount
33-
? String(Math.ceil(replyCount / REPLIES_PER_PAGE))
34-
: "1",
35-
}),
29+
queueJob(
30+
{
31+
type: "discuss",
32+
id: String(id),
33+
page: replyCount
34+
? String(Math.ceil(replyCount / REPLIES_PER_PAGE))
35+
: "1",
36+
},
37+
stream,
38+
),
3639
),
3740
);
3841
break;
@@ -44,7 +47,7 @@ export async function execute(job: Job, stream: Stream) {
4447
job.page ? parseInt(job.page) : undefined,
4548
);
4649
await Promise.all(
47-
articles.map((lid) => queueJob({ type: "article", lid })),
50+
articles.map((lid) => queueJob({ type: "article", lid }, stream)),
4851
);
4952
break;
5053
}
@@ -90,7 +93,7 @@ export async function execute(job: Job, stream: Stream) {
9093

9194
case "article":
9295
await fetchArticle(job.lid);
93-
await queueJob({ type: "articleReplies", lid: job.lid });
96+
await queueJob({ type: "articleReplies", lid: job.lid }, stream);
9497
break;
9598

9699
case "articleReplies": {
@@ -102,7 +105,7 @@ export async function execute(job: Job, stream: Stream) {
102105
if (lastReplyId)
103106
await queueJob(
104107
{ type: "articleReplies", lid: job.lid, after: String(lastReplyId) },
105-
lastReplySaved ? Stream.Routine : Stream.Immediate,
108+
lastReplySaved ? Stream.Routine : stream,
106109
);
107110

108111
break;

0 commit comments

Comments
 (0)