@@ -59,7 +59,7 @@ async function _json(req, res) {
59
59
const words = state . split ( '-' ) ;
60
60
const finalStateName = words . map ( ( word ) => _ . capitalize ( word ) ) . join ( '' ) ;
61
61
jobs = await queue [ `get${ finalStateName } ` ] ( 0 , 1000 ) ;
62
- jobs = jobs . map ( ( j ) => j . toJSON ( ) ) ;
62
+ jobs = jobs . map ( ( j ) => j && j . toJSON ( ) ) ;
63
63
}
64
64
65
65
const filename = `${ queueName } -${ state } -dump.json` ;
@@ -125,13 +125,21 @@ async function _html(req, res) {
125
125
jobs = await queue . getJobs ( stateTypes , startId , endId , order === 'asc' ) ;
126
126
}
127
127
128
- for ( const job of jobs ) {
129
- const jobState = queue . IS_BEE ? job . status : await job . getState ( ) ;
130
- job . showRetryButton = ! queue . IS_BEE || jobState === 'failed' ;
131
- job . retryButtonText = jobState === 'failed' ? 'Retry' : 'Trigger' ;
132
- job . showPromoteButton = ! queue . IS_BEE && jobState === 'delayed' ;
133
- job . showDeleteRepeatableButton = queue . IS_BULL && job . opts . repeat ;
134
- job . parent = JobHelpers . getKeyProperties ( job . parentKey ) ;
128
+ for ( let i = 0 ; i < jobs . length ; i ++ ) {
129
+ if ( ! jobs [ i ] ) {
130
+ jobs [ i ] = {
131
+ showRetryButton : false ,
132
+ showPromoteButton : false ,
133
+ showDeleteRepeatableButton : false ,
134
+ } ;
135
+ } else {
136
+ const jobState = queue . IS_BEE ? jobs [ i ] . status : await jobs [ i ] . getState ( ) ;
137
+ jobs [ i ] . showRetryButton = ! queue . IS_BEE || jobState === 'failed' ;
138
+ jobs [ i ] . retryButtonText = jobState === 'failed' ? 'Retry' : 'Trigger' ;
139
+ jobs [ i ] . showPromoteButton = ! queue . IS_BEE && jobState === 'delayed' ;
140
+ jobs [ i ] . showDeleteRepeatableButton = queue . IS_BULL && jobs [ i ] . opts . repeat ;
141
+ jobs [ i ] . parent = JobHelpers . getKeyProperties ( jobs [ i ] . parentKey ) ;
142
+ }
135
143
}
136
144
137
145
let pages = _ . range ( page - 6 , page + 7 ) . filter ( ( page ) => page >= 1 ) ;
0 commit comments