@@ -51,11 +51,24 @@ export class MarqsConcurrencyMonitor {
51
51
processedKeys : 0 ,
52
52
} ;
53
53
54
- const { stream, redis } = this . marqs . queueConcurrencyScanStream ( 10 , ( ) => {
55
- this . _logger . debug ( "[MarqsConcurrencyMonitor] stream closed" , {
56
- stats,
57
- } ) ;
58
- } ) ;
54
+ const { stream, redis } = this . marqs . queueConcurrencyScanStream (
55
+ 10 ,
56
+ ( ) => {
57
+ this . _logger . debug ( "[MarqsConcurrencyMonitor] stream closed" , {
58
+ stats,
59
+ } ) ;
60
+ } ,
61
+ ( error ) => {
62
+ this . _logger . debug ( "[MarqsConcurrencyMonitor] stream error" , {
63
+ stats,
64
+ error : {
65
+ name : error . name ,
66
+ message : error . message ,
67
+ stack : error . stack ,
68
+ } ,
69
+ } ) ;
70
+ }
71
+ ) ;
59
72
60
73
stream . on ( "data" , async ( keys ) => {
61
74
stream . pause ( ) ;
@@ -80,9 +93,11 @@ export class MarqsConcurrencyMonitor {
80
93
81
94
stats . processedKeys += uniqueKeys . length ;
82
95
83
- await Promise . all ( uniqueKeys . map ( ( key ) => this . #processKey( key , redis ) ) ) . finally ( ( ) => {
84
- stream . resume ( ) ;
85
- } ) ;
96
+ await Promise . allSettled ( uniqueKeys . map ( ( key ) => this . #processKey( key , redis ) ) ) . finally (
97
+ ( ) => {
98
+ stream . resume ( ) ;
99
+ }
100
+ ) ;
86
101
} ) ;
87
102
}
88
103
@@ -91,8 +106,20 @@ export class MarqsConcurrencyMonitor {
91
106
const orgKey = this . keys . orgCurrentConcurrencyKeyFromQueue ( key ) ;
92
107
const envKey = this . keys . envCurrentConcurrencyKeyFromQueue ( key ) ;
93
108
94
- // Next, we need to get all the items from the key, and any parent keys (org, env, queue) using sunion.
95
- const runIds = await redis . sunion ( orgKey , envKey , key ) ;
109
+ let runIds : string [ ] = [ ] ;
110
+
111
+ try {
112
+ // Next, we need to get all the items from the key, and any parent keys (org, env, queue) using sunion.
113
+ runIds = await redis . sunion ( orgKey , envKey , key ) ;
114
+ } catch ( e ) {
115
+ this . _logger . error ( "[MarqsConcurrencyMonitor] error during sunion" , {
116
+ key,
117
+ orgKey,
118
+ envKey,
119
+ runIds,
120
+ error : e ,
121
+ } ) ;
122
+ }
96
123
97
124
if ( runIds . length === 0 ) {
98
125
return ;
0 commit comments