فهرست منبع

fix(docs): Fix JobQueueService.createQueue example code

Michael Bromley 4 سال پیش
والد
کامیت
04dc2ad655
2فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 2 2
      docs/content/plugins/plugin-examples/using-job-queue-service.md
  2. 2 2
      packages/core/src/job-queue/job-queue.service.ts

+ 2 - 2
docs/content/plugins/plugin-examples/using-job-queue-service.md

@@ -44,8 +44,8 @@ class ProductVideoService implements OnModuleInit {
   constructor(private jobQueueService: JobQueueService,
   constructor(private jobQueueService: JobQueueService,
               private connection: TransactionalConnection) {}
               private connection: TransactionalConnection) {}
 
 
-  onModuleInit() {
-    this.jobQueue = this.jobQueueService.createQueue({
+  async onModuleInit() {
+    this.jobQueue = await this.jobQueueService.createQueue({
       name: 'transcode-video',
       name: 'transcode-video',
       process: async job => {
       process: async job => {
         // Here we define how each job in the queue will be processed.
         // Here we define how each job in the queue will be processed.

+ 2 - 2
packages/core/src/job-queue/job-queue.service.ts

@@ -19,9 +19,9 @@ import { CreateQueueOptions, JobData } from './types';
  *
  *
  *   private jobQueue: JobQueue<{ videoId: string; }>;
  *   private jobQueue: JobQueue<{ videoId: string; }>;
  *
  *
- *   onModuleInit() {
+ *   async onModuleInit() {
  *     // The JobQueue is created on initialization
  *     // The JobQueue is created on initialization
- *     this.jobQueue = this.jobQueueService.createQueue({
+ *     this.jobQueue = await this.jobQueueService.createQueue({
  *       name: 'transcode-video',
  *       name: 'transcode-video',
  *       process: async job => {
  *       process: async job => {
  *         return await this.transcodeVideo(job.data.videoId);
  *         return await this.transcodeVideo(job.data.videoId);