@@ -214,23 +214,39 @@ macro_rules! issue_handlers {
214
214
config: & Arc <Config >,
215
215
errors: & mut Vec <HandlerError >,
216
216
) {
217
- $(
218
- match $name:: parse_input( ctx, event, config. $name. as_ref( ) ) . await {
219
- Err ( err) => errors. push( HandlerError :: Message ( err) ) ,
220
- Ok ( Some ( input) ) => {
221
- if let Some ( config) = & config. $name {
222
- $name:: handle_input( ctx, config, event, input) . await . unwrap_or_else( |err| errors. push( HandlerError :: Other ( err) ) ) ;
223
- } else {
224
- errors. push( HandlerError :: Message ( format!(
225
- "The feature `{}` is not enabled in this repository.\n \
226
- To enable it add its section in the `triagebot.toml` \
227
- in the root of the repository.",
228
- stringify!( $name)
229
- ) ) ) ;
217
+ // Process the issue handlers concurrently
218
+ let results = futures:: join!(
219
+ $(
220
+ async {
221
+ match $name:: parse_input( ctx, event, config. $name. as_ref( ) ) . await {
222
+ Err ( err) => Err ( HandlerError :: Message ( err) ) ,
223
+ Ok ( Some ( input) ) => {
224
+ if let Some ( config) = & config. $name {
225
+ $name:: handle_input( ctx, config, event, input) . await . map_err( HandlerError :: Other )
226
+ } else {
227
+ Err ( HandlerError :: Message ( format!(
228
+ "The feature `{}` is not enabled in this repository.\n \
229
+ To enable it add its section in the `triagebot.toml` \
230
+ in the root of the repository.",
231
+ stringify!( $name)
232
+ ) ) )
233
+ }
234
+ }
235
+ Ok ( None ) => Ok ( ( ) )
236
+ }
230
237
}
238
+ ) ,*
239
+ ) ;
240
+
241
+ // Destructure the results into named variables
242
+ let ( $( $name, ) * ) = results;
243
+
244
+ // Push errors for each handler
245
+ $(
246
+ if let Err ( e) = $name {
247
+ errors. push( e) ;
231
248
}
232
- Ok ( None ) => { }
233
- } ) *
249
+ ) *
234
250
}
235
251
}
236
252
}
0 commit comments