0
0
NestJSframework~10 mins

Job options (delay, attempts, priority) in NestJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a delay of 5000 milliseconds to the job.

NestJS
this.queue.add('sendEmail', data, { delay: [1] });
Drag options to blanks, or click blank then click option'
A5
B5000
C500
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using 5 instead of 5000, which means 5 milliseconds, too short.
Using 500 which is 0.5 seconds, not 5 seconds.
2fill in blank
medium

Complete the code to set the job to retry 3 times on failure.

NestJS
this.queue.add('processData', data, { attempts: [1] });
Drag options to blanks, or click blank then click option'
A3
B5
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting attempts to 0 which disables retries.
Setting attempts to 1 which means only one try, no retries.
3fill in blank
hard

Fix the error in setting the job priority to high (1 is highest).

NestJS
this.queue.add('generateReport', data, { priority: [1] });
Drag options to blanks, or click blank then click option'
A1
B5
C10
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 which is invalid priority.
Using 10 which is low priority.
4fill in blank
hard

Fill both blanks to add a job with 2 attempts and 3 seconds delay.

NestJS
this.queue.add('cleanup', data, { attempts: [1], delay: [2] });
Drag options to blanks, or click blank then click option'
A2
B3
C3000
D2000
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing delay units and using 3 instead of 3000.
Setting attempts to 3 instead of 2.
5fill in blank
hard

Fill all three blanks to add a job with high priority (1), 4 attempts, and 1 second delay.

NestJS
this.queue.add('syncData', data, { priority: [1], attempts: [2], delay: [3] });
Drag options to blanks, or click blank then click option'
A1
B4
C1000
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using 5 for priority which is low priority.
Using 1 for attempts which means only one try.
Using 1 for delay which is 1 millisecond, not 1 second.