Enqueue confirmation email
This commit is contained in:
@ -35,6 +35,10 @@ import {
|
||||
REFRESH_ALL_FEEDS_JOB_NAME,
|
||||
REFRESH_FEED_JOB_NAME,
|
||||
} from '../jobs/rss/refreshAllFeeds'
|
||||
import {
|
||||
SendConfirmationEmailData,
|
||||
SEND_CONFIRMATION_EMAIL_JOB,
|
||||
} from '../jobs/send_email'
|
||||
import { SYNC_READ_POSITIONS_JOB_NAME } from '../jobs/sync_read_positions'
|
||||
import { TriggerRuleJobData, TRIGGER_RULE_JOB_NAME } from '../jobs/trigger_rule'
|
||||
import {
|
||||
@ -69,6 +73,7 @@ export const getJobPriority = (jobName: string): number => {
|
||||
case UPDATE_LABELS_JOB:
|
||||
case UPDATE_HIGHLIGHT_JOB:
|
||||
case SYNC_READ_POSITIONS_JOB_NAME:
|
||||
case SEND_CONFIRMATION_EMAIL_JOB:
|
||||
return 1
|
||||
case TRIGGER_RULE_JOB_NAME:
|
||||
case CALL_WEBHOOK_JOB_NAME:
|
||||
@ -839,4 +844,21 @@ export const enqueueExportItem = async (jobData: ExportItemJobData) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const enqueueSendConfirmationEmail = async (
|
||||
jobData: SendConfirmationEmailData
|
||||
) => {
|
||||
const queue = await getBackendQueue()
|
||||
if (!queue) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return queue.add(SEND_CONFIRMATION_EMAIL_JOB, jobData, {
|
||||
attempts: 1, // only try once
|
||||
priority: getJobPriority(SEND_CONFIRMATION_EMAIL_JOB),
|
||||
jobId: `${SEND_CONFIRMATION_EMAIL_JOB}_${jobData.emailAddress}_${JOB_VERSION}`, // deduplication
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true,
|
||||
})
|
||||
}
|
||||
|
||||
export default createHttpTaskWithToken
|
||||
|
||||
Reference in New Issue
Block a user