From a336cc9dc5c257b3b678a7cffdac9e5d1a4869bc Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Tue, 26 Nov 2024 05:56:10 +0000 Subject: [PATCH] Fix Ad --- .../Infrastructures/Events/IEventPublisher.cs | 2 +- .../BotSharp.Abstraction/Utilities/Pagination.cs | 2 ++ .../BotSharp.Core/Infrastructures/Events/RedisPublisher.cs | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Infrastructures/Events/IEventPublisher.cs b/src/Infrastructure/BotSharp.Abstraction/Infrastructures/Events/IEventPublisher.cs index f2276c13..31a708bc 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Infrastructures/Events/IEventPublisher.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Infrastructures/Events/IEventPublisher.cs @@ -10,7 +10,7 @@ public interface IEventPublisher /// Task BroadcastAsync(string channel, string message); - Task PublishAsync(string channel, string message, EventPriority? priority = null); + Task PublishAsync(string channel, string message, EventPriority? priority = null); Task ReDispatchAsync(string channel, int count = 10, string order = "asc"); diff --git a/src/Infrastructure/BotSharp.Abstraction/Utilities/Pagination.cs b/src/Infrastructure/BotSharp.Abstraction/Utilities/Pagination.cs index 8e5c7f23..4d21013b 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Utilities/Pagination.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Utilities/Pagination.cs @@ -1,7 +1,9 @@ using BotSharp.Abstraction.Infrastructures; +using System.Diagnostics; namespace BotSharp.Abstraction.Utilities; +[DebuggerStepThrough] public class Pagination : ICacheKey { private int _page; diff --git a/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisPublisher.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisPublisher.cs index 435451d4..32889f4f 100644 --- a/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisPublisher.cs +++ b/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisPublisher.cs @@ -21,7 +21,7 @@ public class RedisPublisher : IEventPublisher await _subscriber.PublishAsync(channel, message); } - public async Task PublishAsync(string channel, string message, EventPriority? priority = null) + public async Task PublishAsync(string channel, string message, EventPriority? priority = null) { var db = _redis.GetDatabase(); @@ -34,7 +34,7 @@ public class RedisPublisher : IEventPublisher if (CheckMessageExists(db, channel, "message", message)) { _logger.LogError($"The message already exists {channel} {message}"); - return; + return null; } // Add a message to the stream, keeping only the latest 1 million messages @@ -46,6 +46,8 @@ public class RedisPublisher : IEventPublisher maxLength: 1000 * 10000); _logger.LogInformation($"Published message {channel} {message} ({messageId})"); + + return messageId; } private bool CheckMessageExists(IDatabase db, string channel, string fieldName, string desiredValue)