3ca4a11ca3
* feat: basic notification listener sturcuture * feat: clean up generated gql * chore: edited structure * feat: added basic repo * feat: ported comment email to job queue * feat: ported stream access request accepted * feat: added notification insertion * fix: minor typings * feat: delayed notifications * updated types * feat: fixed gql * notifications are listed * index on notifications * feat: while loop skiping for update locked * delayed notification for access request * take into account user prefrences * on comment view, notification is marked as read * feat: added gql notifications * feat: avoid raising errors * fix: error added scopes * fix: mr comments * fix: cursor and service method * feat: added stronger types to notifications and versioning logic * minor: rows updated
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import type { CommandModule } from 'yargs'
|
|
import express from 'express'
|
|
import { ExpressAdapter } from '@bull-board/express'
|
|
import { createBullBoard } from '@bull-board/api'
|
|
import { BullAdapter } from '@bull-board/api/bullAdapter'
|
|
import {
|
|
NOTIFICATIONS_QUEUE,
|
|
buildNotificationsQueue
|
|
} from '@/modules/notifications/services/publication/queue'
|
|
import { noop } from 'lodash-es'
|
|
import { cliLogger } from '@/observability/logging'
|
|
|
|
const PORT = 3032
|
|
|
|
const command: CommandModule<unknown, { testQueueId: string }> = {
|
|
command: 'monitor [testQueueId]',
|
|
describe: 'Run bull-board monitoring web UI',
|
|
builder: {
|
|
testQueueId: {
|
|
describe:
|
|
'Optionally specify the ID of a test queue (from a test run) to load it as well',
|
|
type: 'string'
|
|
}
|
|
},
|
|
handler: async (argv) => {
|
|
const testQueueId = argv.testQueueId
|
|
|
|
cliLogger.info('Initializing bull queues...')
|
|
const queues = [await buildNotificationsQueue(NOTIFICATIONS_QUEUE)]
|
|
|
|
if (testQueueId) {
|
|
cliLogger.info('Also initializing queue %s...', testQueueId)
|
|
queues.push(await buildNotificationsQueue(testQueueId))
|
|
}
|
|
|
|
cliLogger.info('Initializing monitor...')
|
|
const app = express()
|
|
const serverAdapter = new ExpressAdapter()
|
|
|
|
createBullBoard({
|
|
serverAdapter,
|
|
queues: Object.values(queues).map((q) => new BullAdapter(q))
|
|
})
|
|
|
|
app.use(serverAdapter.getRouter())
|
|
|
|
app.listen(PORT, () => {
|
|
cliLogger.info(`Running on ${PORT}...`)
|
|
cliLogger.info(
|
|
`For the UI, open http://127.0.0.1:${PORT}/, and make sure Redis is running`
|
|
)
|
|
})
|
|
|
|
// Waiting forever
|
|
await new Promise(noop)
|
|
}
|
|
}
|
|
|
|
export = command
|