File tree 13 files changed +1120
-35
lines changed
13 files changed +1120
-35
lines changed Original file line number Diff line number Diff line change @@ -229,12 +229,13 @@ class Bree {
229
229
if (
230
230
typeof job . interval !== 'undefined' &&
231
231
typeof job . cron !== 'undefined'
232
- )
232
+ ) {
233
233
errors . push (
234
234
new Error (
235
235
`${ prefix } cannot have both interval and cron configuration`
236
236
)
237
237
) ;
238
+ }
238
239
239
240
// don't allow users to mix timeout AND date
240
241
if ( typeof job . timeout !== 'undefined' && typeof job . date !== 'undefined' )
@@ -306,13 +307,14 @@ class Bree {
306
307
if ( schedule . isValid ( ) ) {
307
308
this . config . jobs [ i ] . interval = schedule ;
308
309
// delete this.config.jobs[i].cron;
309
- } else {
310
- errors . push (
311
- new Error (
312
- `${ prefix } had an invalid cron schedule (see <https://crontab.guru> if you need help)`
313
- )
314
- ) ;
315
- }
310
+ } // else {
311
+ // errors.push(
312
+ // new Error(
313
+ // `${prefix} had an invalid cron schedule (see <https://crontab.guru> if you need help)`
314
+ // )
315
+ // );
316
+ // }
317
+ // above code will never be called
316
318
} else {
317
319
for ( const message of result . getError ( ) ) {
318
320
errors . push (
@@ -330,7 +332,9 @@ class Bree {
330
332
job . closeWorkerAfterMs <= 0 )
331
333
)
332
334
errors . push (
333
- `${ prefix } had an invalid closeWorkerAfterMs value of ${ job . closeWorkerAfterMs } (it must be a finite number > 0`
335
+ new Error (
336
+ `${ prefix } had an invalid closeWorkersAfterMs value of ${ job . closeWorkersAfterMs } (it must be a finite number > 0)`
337
+ )
334
338
) ;
335
339
336
340
// if timeout was undefined, cron was undefined,
Original file line number Diff line number Diff line change 7
7
"files" : [
8
8
" test/*.js" ,
9
9
" test/**/*.js" ,
10
- " !test/jobs"
10
+ " !test/jobs" ,
11
+ " !test/noIndexJobs"
11
12
],
12
13
"verbose" : true
13
14
},
31
32
"devDependencies" : {
32
33
"@commitlint/cli" : " latest" ,
33
34
"@commitlint/config-conventional" : " latest" ,
35
+ "@sinonjs/fake-timers" : " ^6.0.1" ,
34
36
"ava" : " latest" ,
35
37
"codecov" : " latest" ,
36
38
"cross-env" : " latest" ,
39
+ "delay" : " ^4.3.0" ,
37
40
"eslint" : " ^7.4.0" ,
38
41
"eslint-config-xo-lass" : " latest" ,
39
42
"fixpack" : " latest" ,
40
43
"husky" : " latest" ,
44
+ "into-stream" : " ^5.1.1" ,
41
45
"lint-staged" : " latest" ,
42
46
"nyc" : " latest" ,
43
47
"remark-cli" : " latest" ,
Original file line number Diff line number Diff line change
1
+ const delay = require ( 'delay' ) ;
2
+ const { parentPort } = require ( 'worker_threads' ) ;
3
+
4
+ ( async ( ) => {
5
+ await delay ( 1 ) ;
6
+
7
+ if ( parentPort ) {
8
+ parentPort . postMessage ( 'get ready' ) ;
9
+ parentPort . postMessage ( 'done' ) ;
10
+ }
11
+ } ) ( ) ;
Original file line number Diff line number Diff line change
1
+ // eslint-disable-next-line prettier/prettier
2
+ module . exports = [ 'basic' ] ;
Original file line number Diff line number Diff line change
1
+ // eslint-disable-next-line unicorn/no-process-exit
2
+ setInterval ( ( ) => process . exit ( 0 ) , 100 ) ;
Original file line number Diff line number Diff line change
1
+ const { parentPort } = require ( 'worker_threads' ) ;
2
+
3
+ setInterval ( ( ) => { } , 10 ) ;
4
+
5
+ if ( parentPort ) {
6
+ parentPort . on ( 'message' , ( message ) => {
7
+ if ( message === 'error' ) throw new Error ( 'oops' ) ;
8
+ if ( message === 'cancel' ) {
9
+ parentPort . postMessage ( 'cancelled' ) ;
10
+ return ;
11
+ }
12
+
13
+ parentPort . postMessage ( message ) ;
14
+ process . exit ( 0 ) ;
15
+ } ) ;
16
+ }
Original file line number Diff line number Diff line change
1
+ setInterval ( ( ) => { } , 10 ) ;
Original file line number Diff line number Diff line change
1
+ console . log ( 'hello' ) ;
Original file line number Diff line number Diff line change
1
+ # Snapshot report for ` test/test.js `
2
+
3
+ The actual snapshot is saved in ` test.js.snap ` .
4
+
5
+ Generated by [ AVA] ( https://avajs.dev ) .
6
+
7
+ ## creates job with cron string
8
+
9
+ > Snapshot 1
10
+
11
+ {
12
+ isValid: Function isValid {},
13
+ next: Function next {},
14
+ nextRange: Function nextRange {},
15
+ prev: Function prev {},
16
+ prevRange: Function prevRange {},
17
+ }
18
+
19
+ ## parseValue()
20
+
21
+ > Snapshot 1
22
+
23
+ {
24
+ isValid: Function isValid {},
25
+ next: Function next {},
26
+ nextRange: Function nextRange {},
27
+ prev: Function prev {},
28
+ prevRange: Function prevRange {},
29
+ }
30
+
31
+ ## getWorkerMetadata()
32
+
33
+ > Snapshot 1
34
+
35
+ {}
You can’t perform that action at this time.
0 commit comments