You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('#start(lifespan) FUNDAMENTAL TEST (queue started with lifespan will process a job with job timeout set).',async()=>{
57
+
58
+
constqueue=awaitQueueFactory();
59
+
queue.flushQueue();
60
+
constjobName='job-name';
61
+
62
+
// Track the jobs that have executed to test against.
63
+
letexecutedJobs=[];
64
+
65
+
queue.addWorker(jobName,async(id,payload)=>{
66
+
67
+
// Track jobs that exec
68
+
executedJobs.push(payload.trackingName);
69
+
70
+
});
71
+
72
+
// Create a job but don't auto-start queue
73
+
queue.createJob(jobName,{
74
+
trackingName: jobName
75
+
},{
76
+
timeout: 100
77
+
},false);
78
+
79
+
// startQueue is false so queue should not have started.
80
+
queue.status.should.equal('inactive');
81
+
82
+
// Start queue with lifespan, don't await so this test can continue while queue processes.
83
+
queue.start(750);
84
+
85
+
queue.status.should.equal('active');
86
+
87
+
// wait a bit for queue to process job
88
+
awaitnewPromise((resolve)=>{
89
+
setTimeout(resolve,750);
90
+
});
91
+
92
+
//Check that the correct jobs executed.
93
+
executedJobs.should.deepEqual(['job-name']);
94
+
95
+
// Queue should have stopped.
96
+
queue.status.should.equal('inactive');
97
+
98
+
});
99
+
56
100
it('#start(lifespan) BASIC TEST (One job type, default job/worker options): queue will process jobs with timeout set as expected until lifespan ends.',async()=>{
57
101
102
+
// This test will intermittently fail in CI environments like travis-ci.
103
+
// Intermittent failure is a result of the poor performance of CI environments
104
+
// causing the timeouts in this test to become really flakey (setTimeout can't
105
+
// guarantee exact time of function execution, and in a high load env execution can
0 commit comments