Changing default priorities of ntfy messages
This commit is contained in:
parent
a0405e7027
commit
50eb6174e0
1 changed files with 12 additions and 2 deletions
|
|
@ -5,7 +5,12 @@ import { Job, JobOptions, Queue } from 'bull'
|
||||||
import { Dayjs } from 'dayjs'
|
import { Dayjs } from 'dayjs'
|
||||||
|
|
||||||
import { NtfyClient } from './client'
|
import { NtfyClient } from './client'
|
||||||
import { MessageConfig, MessageTags, NTFY_PUBLISH_QUEUE_NAME } from './types'
|
import {
|
||||||
|
MessageConfig,
|
||||||
|
MessagePriority,
|
||||||
|
MessageTags,
|
||||||
|
NTFY_PUBLISH_QUEUE_NAME,
|
||||||
|
} from './types'
|
||||||
|
|
||||||
@Processor(NTFY_PUBLISH_QUEUE_NAME)
|
@Processor(NTFY_PUBLISH_QUEUE_NAME)
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
@ -36,7 +41,10 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
||||||
data: Omit<MessageConfig, 'topic'>,
|
data: Omit<MessageConfig, 'topic'>,
|
||||||
): [Omit<MessageConfig, 'topic'>, JobOptions] {
|
): [Omit<MessageConfig, 'topic'>, JobOptions] {
|
||||||
return [
|
return [
|
||||||
data,
|
{
|
||||||
|
...data,
|
||||||
|
priority: MessagePriority.min,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
attempts: 3,
|
attempts: 3,
|
||||||
removeOnComplete: true,
|
removeOnComplete: true,
|
||||||
|
|
@ -99,6 +107,7 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
||||||
) {
|
) {
|
||||||
await this.publishQueue.add(
|
await this.publishQueue.add(
|
||||||
...NtfyProvider.defaultJob({
|
...NtfyProvider.defaultJob({
|
||||||
|
priority: MessagePriority.default,
|
||||||
title: 'Error performing reservation',
|
title: 'Error performing reservation',
|
||||||
message: `${reservationId} - ${startTime.format()} to ${endTime.format()} : (${
|
message: `${reservationId} - ${startTime.format()} to ${endTime.format()} : (${
|
||||||
error.name
|
error.name
|
||||||
|
|
@ -135,6 +144,7 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
||||||
async sendEmailClientErrorNotification(errorMessage: string) {
|
async sendEmailClientErrorNotification(errorMessage: string) {
|
||||||
await this.publishQueue.add(
|
await this.publishQueue.add(
|
||||||
...NtfyProvider.defaultJob({
|
...NtfyProvider.defaultJob({
|
||||||
|
priority: MessagePriority.high,
|
||||||
title: 'Email client error',
|
title: 'Email client error',
|
||||||
message: errorMessage,
|
message: errorMessage,
|
||||||
tags: [MessageTags.exclamation],
|
tags: [MessageTags.exclamation],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue