feat: improve error logging and streamline consumer prefetch handling… - #31
Conversation
… in ConsumersService
📝 WalkthroughWalkthroughUpdates error logging level for consumer cancellation failures and consolidates consumer QoS reconfiguration logic by removing a separate Prefetch-specific branch in favor of unified property updates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
SW.Bus/ConsumersService.cs (1)
222-249: Prefetch‑only updates are now ignored.Line 222–225 only detect args/priority changes; Line 240 applies
BasicQosonly inside that branch. If onlyQueuePrefetchchanges, it falls into Line 246–249 and never updates QoS, so the channel keeps the old prefetch.🐛 Suggested fix (apply QoS when prefetch changes)
- var argsChanged = !DictionariesEqual(existingDef.ConsumerArgs, def.ConsumerArgs); - var priorityChanged = existingDef.ConsumerPriority != def.ConsumerPriority; + var argsChanged = !DictionariesEqual(existingDef.ConsumerArgs, def.ConsumerArgs); + var priorityChanged = existingDef.ConsumerPriority != def.ConsumerPriority; + var prefetchChanged = existingDef.QueuePrefetch != def.QueuePrefetch; - if (priorityChanged || argsChanged) + if (priorityChanged || argsChanged) { logger.LogInformation($"Configuration changed for {def.QueueName}. Restarting consumer."); try { existingModel.BasicCancel(existingDef.ConsumerTag); } catch (Exception ex) { logger.LogError(ex, $"Failed to cancel consumer {def.QueueName}"); } // Update properties (including Args) BEFORE re-consuming existingDef.UpdateConsumerProps(def); existingModel.BasicQos(0, def.QueuePrefetch, false); existingDef.ConsumerTag = existingModel.BasicConsume(def.QueueName, false, "", existingDef.ConsumerArgs, existingDef.ConsumerObject); } else { existingDef.UpdateConsumerProps(def); + if (prefetchChanged) + existingModel.BasicQos(0, def.QueuePrefetch, false); }
… in ConsumersService
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.