Performance: Named jobs
MEDIUM IMPACT
Named jobs affect how background tasks are scheduled and managed, impacting server responsiveness and resource usage.
await this.queue.add('sendEmail', { userId: 1 }, { jobId: 'sendEmail:1' }); await this.queue.add('sendEmail', { userId: 1 }, { jobId: 'sendEmail:1' });
await this.queue.add('sendEmail', { userId: 1 }); await this.queue.add('sendEmail', { userId: 1 });
| Pattern | CPU Usage | Memory Usage | Duplicate Jobs | Verdict |
|---|---|---|---|---|
| Unnamed jobs | High due to duplicates | High due to multiple job data | Yes | [X] Bad |
| Named jobs with unique jobId | Lower by avoiding duplicates | Lower by single job instance | No | [OK] Good |