Enqueue new feeds at front
This commit is contained in:
@ -90,9 +90,12 @@ export const queueRSSRefreshAllFeedsJob = async () => {
|
||||
return queue.add('refresh-all-feeds', {})
|
||||
}
|
||||
|
||||
type QueuePriority = 'low' | 'high'
|
||||
|
||||
export const queueRSSRefreshFeedJob = async (
|
||||
jobid: string,
|
||||
payload: any
|
||||
payload: any,
|
||||
options = { priority: 'high' as QueuePriority }
|
||||
): Promise<Job | undefined> => {
|
||||
const queue = createBackendQueue()
|
||||
if (!queue) {
|
||||
@ -102,5 +105,6 @@ export const queueRSSRefreshFeedJob = async (
|
||||
jobId: jobid,
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true,
|
||||
lifo: options.priority == 'high',
|
||||
})
|
||||
}
|
||||
|
||||
@ -660,7 +660,9 @@ export const enqueueRssFeedFetch = async (
|
||||
)}_${stringToHash(JSON.stringify(subscriptionGroup.userIds.sort()))}`
|
||||
|
||||
if (redisDataSource.workerRedisClient) {
|
||||
let job = await queueRSSRefreshFeedJob(jobid, payload)
|
||||
let job = await queueRSSRefreshFeedJob(jobid, payload, {
|
||||
priority: 'high',
|
||||
})
|
||||
if (!job || !job.id) {
|
||||
throw 'unable to queue rss-refresh-feed-job, job did not enqueue'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user