Browse Source

fix for job queue inits all over to include configs

pull/2/head
Rob Colbert 3 years ago
parent
commit
893a345e9f
  1. 4
      app/controllers/email.js
  2. 2
      app/services/attachment.js
  3. 10
      app/services/chat.js
  4. 2
      app/services/sticker.js
  5. 2
      app/workers/chat/job/chat-room-clear.js
  6. 2
      app/workers/chat/job/chat-room-delete.js
  7. 2
      app/workers/media.js
  8. 2
      app/workers/media/job/attachment-delete.js
  9. 2
      app/workers/media/job/attachment-ingest.js
  10. 2
      app/workers/media/job/sticker-delete.js
  11. 2
      app/workers/media/job/sticker-ingest.js
  12. 2
      app/workers/newsletter/job/email-send.js
  13. 2
      app/workers/newsletter/job/transmit.js
  14. 2
      docs/samples/service.js

4
app/controllers/email.js

@ -17,9 +17,7 @@ class EmailController extends SiteController {
async start ( ) { async start ( ) {
const { jobQueue: jobQueueService, limiter: limiterService } = this.dtp.services; const { jobQueue: jobQueueService, limiter: limiterService } = this.dtp.services;
this.emailJobQueue = jobQueueService.getJobQueue('email', { this.emailJobQueue = jobQueueService.getJobQueue('email', this.dtp.config.jobQueues.email);
attempts: 3
});
const router = express.Router(); const router = express.Router();
this.dtp.app.use('/email', router); this.dtp.app.use('/email', router);

2
app/services/attachment.js

@ -29,7 +29,7 @@ class AttachmentService extends SiteService {
}, },
]; ];
this.queue = this.getJobQueue('media'); this.queue = this.getJobQueue('media', this.dtp.config.jobQueues.media);
// this.template = this.loadViewTemplate('attachment/components/attachment-standalone.pug'); // this.template = this.loadViewTemplate('attachment/components/attachment-standalone.pug');
} }

10
app/services/chat.js

@ -31,7 +31,12 @@ class ChatService extends SiteService {
} }
async start ( ) { async start ( ) {
const { user: userService, limiter: limiterService } = this.dtp.services; const {
jobQueue: jobQueueService,
user: userService,
limiter: limiterService,
} = this.dtp.services;
await super.start(); await super.start();
this.populateChatMessage = [ this.populateChatMessage = [
@ -122,7 +127,8 @@ class ChatService extends SiteService {
this.emitter = ioEmitter(this.dtp.redis); this.emitter = ioEmitter(this.dtp.redis);
this.queues = { this.queues = {
reeeper: await this.getJobQueue('reeeper'), media: jobQueueService.getJobQueue('media', this.dtp.config.jobQueues.media),
reeeper: jobQueueService.getJobQueue('reeeper', this.dtp.config.jobQueues.reeeper),
}; };
} }

2
app/services/sticker.js

@ -33,7 +33,7 @@ class StickerService extends SiteService {
}, },
]; ];
this.queue = this.getJobQueue('media'); this.queue = this.getJobQueue('media', this.dtp.config.jobQueues.media);
this.stickerTemplate = this.loadViewTemplate('sticker/components/sticker-standalone.pug'); this.stickerTemplate = this.loadViewTemplate('sticker/components/sticker-standalone.pug');
} }

2
app/workers/chat/job/chat-room-clear.js

@ -28,7 +28,7 @@ class ChatRoomClearJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('chat'); this.queue = await this.getJobQueue('chat', this.dtp.config.jobQueues.chat);
this.log.info('registering job processor', { queue: this.queue.name, name: 'chat-room-clear' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'chat-room-clear' });
this.queue.process('chat-room-clear', this.processChatRoomClear.bind(this)); this.queue.process('chat-room-clear', this.processChatRoomClear.bind(this));

2
app/workers/chat/job/chat-room-delete.js

@ -37,7 +37,7 @@ class ChatRoomDeleteJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('chat'); this.queue = await this.getJobQueue('chat', this.dtp.config.jobQueues.chat);
this.log.info('registering job processor', { queue: this.queue.name, name: 'chat-room-delete' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'chat-room-delete' });
this.queue.process('chat-room-delete', this.processChatRoomDelete.bind(this)); this.queue.process('chat-room-delete', this.processChatRoomDelete.bind(this));

2
app/workers/media.js

@ -48,7 +48,7 @@ class MediaWorker extends SiteWorker {
const stickerId = mongoose.Types.ObjectId(process.argv[2]); const stickerId = mongoose.Types.ObjectId(process.argv[2]);
this.log.info('creating sticker processing job', { stickerId }); this.log.info('creating sticker processing job', { stickerId });
const queue = this.getJobQueue('media'); const queue = this.getJobQueue('media', this.dtp.config.jobQueues.media);
await queue.add('sticker-ingest', { stickerId }); await queue.add('sticker-ingest', { stickerId });
} }

2
app/workers/media/job/attachment-delete.js

@ -27,7 +27,7 @@ class AttachmentDeleteJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('media'); this.queue = await this.getJobQueue('media', this.dtp.config.jobQueues.media);
this.log.info('registering job processor', { queue: this.queue.name, name: 'attachment-delete' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'attachment-delete' });
this.queue.process('attachment-delete', 1, this.processAttachmentDelete.bind(this)); this.queue.process('attachment-delete', 1, this.processAttachmentDelete.bind(this));

2
app/workers/media/job/attachment-ingest.js

@ -35,7 +35,7 @@ class AttachmentIngestJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('media'); this.queue = await this.getJobQueue('media', this.dtp.config.jobQueues.media);
this.log.info('registering job processor', { queue: this.queue.name, name: 'attachment-ingest' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'attachment-ingest' });
this.queue.process('attachment-ingest', 1, this.processAttachmentIngest.bind(this)); this.queue.process('attachment-ingest', 1, this.processAttachmentIngest.bind(this));

2
app/workers/media/job/sticker-delete.js

@ -27,7 +27,7 @@ class StickerDeleteJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('media'); this.queue = await this.getJobQueue('media', this.dtp.config.jobQueues.media);
this.log.info('registering job processor', { queue: this.queue.name, name: 'sticker-ingest' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'sticker-ingest' });
this.queue.process('sticker-delete', 1, this.processStickerDelete.bind(this)); this.queue.process('sticker-delete', 1, this.processStickerDelete.bind(this));

2
app/workers/media/job/sticker-ingest.js

@ -36,7 +36,7 @@ class StickerIngestJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('media'); this.queue = await this.getJobQueue('media', this.dtp.config.jobQueues.media);
this.log.info('registering job processor', { queue: this.queue.name, name: 'sticker-ingest' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'sticker-ingest' });
this.queue.process('sticker-ingest', 1, this.processStickerIngest.bind(this)); this.queue.process('sticker-ingest', 1, this.processStickerIngest.bind(this));

2
app/workers/newsletter/job/email-send.js

@ -24,7 +24,7 @@ class NewsletterEmailSendJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('newsletter'); this.queue = await this.getJobQueue('newsletter', this.dtp.config.jobQueues.newsletter);
this.log.info('registering job processor', { queue: this.queue.name, name: 'email-send' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'email-send' });
this.queue.process('email-send', this.processEmailSend.bind(this)); this.queue.process('email-send', this.processEmailSend.bind(this));

2
app/workers/newsletter/job/transmit.js

@ -29,7 +29,7 @@ class NewsletterTransmitJob extends SiteWorkerProcess {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = await this.getJobQueue('newsletter'); this.queue = await this.getJobQueue('newsletter', this.dtp.config.jobQueues.newsletter);
this.log.info('registering job processor', { queue: this.queue.name, name: 'transmit' }); this.log.info('registering job processor', { queue: this.queue.name, name: 'transmit' });
this.queue.process('transmit', this.processTransmit.bind(this)); this.queue.process('transmit', this.processTransmit.bind(this));

2
docs/samples/service.js

@ -19,7 +19,7 @@ class SampleService extends SiteService {
async start ( ) { async start ( ) {
await super.start(); await super.start();
this.queue = this.getJobQueue('sample'); this.queue = this.getJobQueue('sample', this.dtp.config.jobQueues.sample);
} }
async stop ( ) { async stop ( ) {

Loading…
Cancel
Save