@@ -32,16 +32,18 @@ use crate::event_dispatcher::db::EventDispatcherDbConnection;
3232use crate :: event_dispatcher:: TEST_EVENT_OBSERVER_SKIP_RETRY ;
3333use crate :: event_dispatcher:: { EventDispatcherError , EventRequestData } ;
3434
35- #[ allow( dead_code) ] // NoOp is only used in test configurations
35+ struct PayloadInfo {
36+ /// The id of the payload data in the event observer DB. It must exist.
37+ id : i64 ,
38+ /// If true, the HTTP request is only attempted once.
39+ disable_retries : bool ,
40+ /// A value for the HTTP timeout is stored in the DB, but can optionally be overridden.
41+ timeout_override : Option < Duration > ,
42+ }
43+
3644enum WorkerTask {
37- Payload {
38- /// The id of the payload data in the event observer DB. It must exist.
39- id : i64 ,
40- /// If true, the HTTP request is only attempted once.
41- disable_retries : bool ,
42- /// A value for the HTTP timeout is stored in the DB, but can optionally be overridden.
43- timeout_override : Option < Duration > ,
44- } ,
45+ Payload ( PayloadInfo ) ,
46+ #[ cfg( any( test, feature = "testing" ) ) ]
4547 NoOp ,
4648}
4749struct WorkerMessage {
@@ -182,11 +184,11 @@ impl EventDispatcherWorker {
182184 debug ! ( "Event Dispatcher Worker: sending payload {id}" ) ;
183185
184186 self . sender . send ( WorkerMessage {
185- task : WorkerTask :: Payload {
187+ task : WorkerTask :: Payload ( PayloadInfo {
186188 id,
187189 disable_retries,
188190 timeout_override,
189- } ,
191+ } ) ,
190192 completion : sender,
191193 } ) ?;
192194
@@ -231,16 +233,20 @@ impl EventDispatcherWorker {
231233 return ;
232234 } ;
233235
234- let WorkerTask :: Payload {
236+ let PayloadInfo {
235237 id,
236238 disable_retries,
237239 timeout_override,
238- } = task
239- else {
240- // no-op -- just ack and move on
241- debug ! ( "Event Dispatcher Worker: doing no-op" ) ;
242- let _ = completion. send ( ( ) ) ;
243- continue ;
240+ } = match task {
241+ WorkerTask :: Payload ( p) => p,
242+
243+ #[ cfg( any( test, feature = "testing" ) ) ]
244+ WorkerTask :: NoOp => {
245+ // just ack and move on
246+ debug ! ( "Event Dispatcher Worker: doing no-op" ) ;
247+ let _ = completion. send ( ( ) ) ;
248+ continue ;
249+ }
244250 } ;
245251
246252 debug ! ( "Event Dispatcher Worker: doing payload {id}" ) ;
0 commit comments