You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/server/core/scheduler.js

29 lines
690 B

const PgBoss = require('pg-boss')
/* global WIKI */
module.exports = {
scheduler: null,
jobs: [],
init () {
WIKI.logger.info('Initializing Scheduler...')
this.scheduler = new PgBoss({
...WIKI.models.knex.client.connectionSettings,
application_name: 'Wiki.js Scheduler',
schema: WIKI.config.db.schemas.scheduler,
uuid: 'v4'
})
return this
},
async start () {
WIKI.logger.info('Starting Scheduler...')
await this.scheduler.start()
WIKI.logger.info('Scheduler: [ STARTED ]')
},
async stop () {
WIKI.logger.info('Stopping Scheduler...')
await this.scheduler.stop()
WIKI.logger.info('Scheduler: [ STOPPED ]')
}
}