@@ -553,18 +553,6 @@ mongoc_cluster_run_command_monitored (mongoc_cluster_t *cluster,
553
553
cluster , cmd , compressor_id , reply , error );
554
554
}
555
555
556
- if (_mongoc_cse_is_enabled (cluster -> client )) {
557
- bson_destroy (& decrypted );
558
- retval = _mongoc_cse_auto_decrypt (
559
- cluster -> client , cmd -> db_name , reply , & decrypted , error );
560
- bson_destroy (reply );
561
- bson_steal (reply , & decrypted );
562
- bson_init (& decrypted );
563
- if (!retval ) {
564
- goto fail_no_events ;
565
- }
566
- }
567
-
568
556
if (retval && callbacks -> succeeded ) {
569
557
bson_t fake_reply = BSON_INITIALIZER ;
570
558
/*
@@ -612,6 +600,18 @@ mongoc_cluster_run_command_monitored (mongoc_cluster_t *cluster,
612
600
mongoc_apm_command_failed_cleanup (& failed_event );
613
601
}
614
602
603
+ if (retval && _mongoc_cse_is_enabled (cluster -> client )) {
604
+ bson_destroy (& decrypted );
605
+ retval = _mongoc_cse_auto_decrypt (
606
+ cluster -> client , cmd -> db_name , reply , & decrypted , error );
607
+ bson_destroy (reply );
608
+ bson_steal (reply , & decrypted );
609
+ bson_init (& decrypted );
610
+ if (!retval ) {
611
+ goto fail_no_events ;
612
+ }
613
+ }
614
+
615
615
_handle_not_primary_error (cluster , server_stream , reply );
616
616
617
617
_handle_txn_error_labels (retval , error , cmd , reply );
0 commit comments