Explorar el Código

fix(docs): Fix JobQueueService.createQueue example code

Michael Bromley hace 4 años
padre
commit
04dc2ad655

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

@@ -44,8 +44,8 @@ class ProductVideoService implements OnModuleInit {
   constructor(private jobQueueService: JobQueueService,
               private connection: TransactionalConnection) {}
 
-  onModuleInit() {
-    this.jobQueue = this.jobQueueService.createQueue({
+  async onModuleInit() {
+    this.jobQueue = await this.jobQueueService.createQueue({
       name: 'transcode-video',
       process: async job => {
         // 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; }>;
  *
- *   onModuleInit() {
+ *   async onModuleInit() {
  *     // The JobQueue is created on initialization
- *     this.jobQueue = this.jobQueueService.createQueue({
+ *     this.jobQueue = await this.jobQueueService.createQueue({
  *       name: 'transcode-video',
  *       process: async job => {
  *         return await this.transcodeVideo(job.data.videoId);