@@ -5,14 +5,15 @@ const PgBoss = require('../../src')
55const SCHEMA_COUNT = 60
66const QUEUE_COUNT = 200
77
8- loadTest ( )
9- . catch ( err => {
10- console . log ( err )
11- process . exit ( 1 )
12- } )
8+ loadTest ( ) . catch ( ( err ) => {
9+ console . log ( err )
10+ process . exit ( 1 )
11+ } )
1312
1413async function loadTest ( ) {
15- const schemas = new Array ( SCHEMA_COUNT ) . fill ( null ) . map ( ( _ , index ) => `schema${ index } ` )
14+ const schemas = new Array ( SCHEMA_COUNT )
15+ . fill ( null )
16+ . map ( ( _ , index ) => `schema${ index } ` )
1617
1718 for ( const schema of schemas ) {
1819 setImmediate ( ( ) => init ( schema ) )
@@ -21,31 +22,40 @@ async function loadTest () {
2122
2223async function init ( schema ) {
2324 const config = helper . getConfig ( )
24- const boss = new PgBoss ( { ...config , schema, supervise : false , schedule : false } )
25+ const boss = new PgBoss ( {
26+ ...config ,
27+ schema,
28+ supervise : false ,
29+ schedule : false
30+ } )
2531
2632 boss . on ( 'error' , console . error )
2733
2834 await boss . start ( )
2935
3036 console . log ( 'creating queues' )
3137
32- const queues = new Array ( QUEUE_COUNT ) . fill ( null ) . map ( ( _ , index ) => `queue${ index } ` )
38+ const queues = new Array ( QUEUE_COUNT )
39+ . fill ( null )
40+ . map ( ( _ , index ) => `queue${ index } ` )
3341
3442 for ( const queue of queues ) {
3543 console . log ( `creating queue ${ schema } .${ queue } ` )
3644 await boss . createQueue ( queue )
37- await boss . work ( queue , ( ) => { } )
45+ await boss . work ( queue , ( ) => { } )
3846 }
3947
4048 console . log ( 'created queues' )
4149
4250 while ( true ) {
4351 console . log ( `${ schema } : sending a job to each one: ${ new Date ( ) } ` )
4452
45- await Promise . all ( queues . map ( async queue => {
46- await boss . send ( queue )
47- await boss . fetch ( queue )
48- } ) )
53+ await Promise . all (
54+ queues . map ( async ( queue ) => {
55+ await boss . send ( queue )
56+ await boss . fetch ( queue )
57+ } )
58+ )
4959
5060 await delay ( 1000 )
5161 }
0 commit comments