@@ -11,7 +11,8 @@ use crate::{
11
11
CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION ,
12
12
CALL_V3_EARLY_RESPONSE_INGRESS_WATCHER_NOT_RUNNING ,
13
13
CALL_V3_EARLY_RESPONSE_MESSAGE_ALREADY_IN_CERTIFIED_STATE ,
14
- CALL_V3_EARLY_RESPONSE_SUBSCRIPTION_TIMEOUT ,
14
+ CALL_V3_EARLY_RESPONSE_SUBSCRIPTION_TIMEOUT , CALL_V3_STATUS_IS_INVALID_UTF8 ,
15
+ CALL_V3_STATUS_IS_NOT_LEAF ,
15
16
} ,
16
17
HttpError ,
17
18
} ;
@@ -224,16 +225,11 @@ async fn call_sync_v3(
224
225
. await
225
226
{
226
227
Ok ( Ok ( message_subscriber) ) => Ok ( message_subscriber) ,
227
- Ok ( Err ( SubscriptionError :: DuplicateSubscriptionError ) ) => {
228
- // TODO: At this point we could return early without submitting the ingress message.
229
- Err ( (
230
- "Duplicate request. Message is already being tracked and executed." ,
231
- CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION ,
232
- ) )
233
- }
228
+ Ok ( Err ( SubscriptionError :: DuplicateSubscriptionError ) ) => Err ( (
229
+ "Duplicate request. Message is already being tracked and executed." ,
230
+ CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION ,
231
+ ) ) ,
234
232
Ok ( Err ( SubscriptionError :: IngressWatcherNotRunning { error_message } ) ) => {
235
- // TODO: Send a warning or notification.
236
- // This probably means that the ingress watcher panicked.
237
233
error ! (
238
234
every_n_seconds => LOG_EVERY_N_SECONDS ,
239
235
log,
@@ -302,7 +298,6 @@ async fn call_sync_v3(
302
298
) ;
303
299
} ;
304
300
305
- // Log the status of the message.
306
301
let status_label = match parsed_message_status ( & tree, & message_id) {
307
302
ParsedMessageStatus :: Known ( status) => status,
308
303
ParsedMessageStatus :: Unknown => "unknown" . to_string ( ) ,
@@ -333,11 +328,12 @@ fn parsed_message_status(tree: &MixedHashTree, message_id: &MessageId) -> Parsed
333
328
334
329
match tree. lookup ( & status_path) {
335
330
LookupStatus :: Found ( MixedHashTree :: Leaf ( status) ) => ParsedMessageStatus :: Known (
336
- String :: from_utf8 ( status. clone ( ) ) . unwrap_or_else ( |_| "invalid_utf8_status" . to_string ( ) ) ,
331
+ String :: from_utf8 ( status. clone ( ) )
332
+ . unwrap_or_else ( |_| CALL_V3_STATUS_IS_INVALID_UTF8 . to_string ( ) ) ,
337
333
) ,
338
- // This should never happen. Otherwise the tree is not following the spec.
339
- // TODO: Log as error.
340
- LookupStatus :: Found ( _ ) => ParsedMessageStatus :: Known ( "Status not a leaf" . to_string ( ) ) ,
334
+ LookupStatus :: Found ( _ ) => {
335
+ ParsedMessageStatus :: Known ( CALL_V3_STATUS_IS_NOT_LEAF . to_string ( ) )
336
+ }
341
337
LookupStatus :: Absent | LookupStatus :: Unknown => ParsedMessageStatus :: Unknown ,
342
338
}
343
339
}
0 commit comments