1212using Foundatio . Redis . Utility ;
1313using Microsoft . Extensions . Logging ;
1414using StackExchange . Redis ;
15- #pragma warning disable 4014
1615
1716namespace Foundatio . Queues ;
1817
@@ -504,9 +503,10 @@ await _resiliencePolicy.ExecuteAsync(async _ => await Task.WhenAll(
504503
505504 var tx = Database . CreateTransaction ( ) ;
506505 tx . AddCondition ( Condition . KeyExists ( GetRenewedTimeKey ( entry . Id ) ) ) ;
507- tx . ListRemoveAsync ( _workListName , entry . Id ) ;
508- tx . ListLeftPushAsync ( _waitListName , entry . Id ) ;
509- tx . KeyDeleteAsync ( GetRenewedTimeKey ( entry . Id ) ) ;
506+ // Transaction-queued: commands execute atomically with ExecuteAsync(); individual results are not needed.
507+ _ = tx . ListRemoveAsync ( _workListName , entry . Id ) ;
508+ _ = tx . ListLeftPushAsync ( _waitListName , entry . Id ) ;
509+ _ = tx . KeyDeleteAsync ( GetRenewedTimeKey ( entry . Id ) ) ;
510510 bool success = await _resiliencePolicy . ExecuteAsync ( async _ => await tx . ExecuteAsync ( ) ) . AnyContext ( ) ;
511511 if ( ! success )
512512 throw new QueueException ( "Queue entry not in work list, it may have been auto abandoned." ) ;
@@ -521,9 +521,10 @@ await _resiliencePolicy.ExecuteAsync(async _ => await Task.WhenAll(
521521
522522 var tx = Database . CreateTransaction ( ) ;
523523 tx . AddCondition ( Condition . KeyExists ( GetRenewedTimeKey ( entry . Id ) ) ) ;
524- tx . ListRemoveAsync ( _workListName , entry . Id ) ;
525- tx . ListLeftPushAsync ( _queueListName , entry . Id ) ;
526- tx . KeyDeleteAsync ( GetRenewedTimeKey ( entry . Id ) ) ;
524+ // Transaction-queued: commands execute atomically with ExecuteAsync(); individual results are not needed.
525+ _ = tx . ListRemoveAsync ( _workListName , entry . Id ) ;
526+ _ = tx . ListLeftPushAsync ( _queueListName , entry . Id ) ;
527+ _ = tx . KeyDeleteAsync ( GetRenewedTimeKey ( entry . Id ) ) ;
527528 bool success = await _resiliencePolicy . ExecuteAsync ( async _ => await tx . ExecuteAsync ( ) ) . AnyContext ( ) ;
528529 if ( ! success )
529530 throw new QueueException ( "Queue entry not in work list, it may have been auto abandoned." ) ;
@@ -548,10 +549,11 @@ private async Task DeadLetterMessageAsync(IQueueEntry<T> entry, int? attempts =
548549
549550 var tx = Database . CreateTransaction ( ) ;
550551 tx . AddCondition ( Condition . KeyExists ( GetRenewedTimeKey ( entry . Id ) ) ) ;
551- tx . ListRemoveAsync ( _workListName , entry . Id ) ;
552- tx . ListLeftPushAsync ( _deadListName , entry . Id ) ;
553- tx . KeyDeleteAsync ( GetRenewedTimeKey ( entry . Id ) ) ;
554- tx . KeyExpireAsync ( GetPayloadKey ( entry . Id ) , _options . DeadLetterTimeToLive ) ;
552+ // Transaction-queued: commands execute atomically with ExecuteAsync(); individual results are not needed.
553+ _ = tx . ListRemoveAsync ( _workListName , entry . Id ) ;
554+ _ = tx . ListLeftPushAsync ( _deadListName , entry . Id ) ;
555+ _ = tx . KeyDeleteAsync ( GetRenewedTimeKey ( entry . Id ) ) ;
556+ _ = tx . KeyExpireAsync ( GetPayloadKey ( entry . Id ) , _options . DeadLetterTimeToLive ) ;
555557 bool success = await _resiliencePolicy . ExecuteAsync ( async _ => await tx . ExecuteAsync ( ) ) . AnyContext ( ) ;
556558 if ( ! success )
557559 throw new QueueException ( "Queue entry not in work list, it may have been auto abandoned." ) ;
@@ -724,9 +726,10 @@ public async Task DoMaintenanceWorkAsync()
724726 _logger . LogDebug ( "{WaitId}: Adding item back to queue for retry" , waitId ) ;
725727
726728 var tx = Database . CreateTransaction ( ) ;
727- tx . ListRemoveAsync ( _waitListName , waitId ) ;
728- tx . ListLeftPushAsync ( _queueListName , waitId ) ;
729- tx . KeyDeleteAsync ( GetWaitTimeKey ( waitId . ToString ( ) ) ) ;
729+ // Transaction-queued: commands execute atomically with ExecuteAsync(); individual results are not needed.
730+ _ = tx . ListRemoveAsync ( _waitListName , waitId ) ;
731+ _ = tx . ListLeftPushAsync ( _queueListName , waitId ) ;
732+ _ = tx . KeyDeleteAsync ( GetWaitTimeKey ( waitId . ToString ( ) ) ) ;
730733 bool success = await _resiliencePolicy . ExecuteAsync ( async _ => await tx . ExecuteAsync ( ) ) . AnyContext ( ) ;
731734 if ( ! success )
732735 throw new Exception ( "Unable to move item to queue list." ) ;
0 commit comments