Skip to content

Commit b4e0f1d

Browse files
Merge branch 'master' into lida_Dev
2 parents c75043d + a336cc9 commit b4e0f1d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/Infrastructure/BotSharp.Abstraction/Infrastructures/Events/IEventPublisher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IEventPublisher
1010
/// <returns></returns>
1111
Task BroadcastAsync(string channel, string message);
1212

13-
Task PublishAsync(string channel, string message, EventPriority? priority = null);
13+
Task<string?> PublishAsync(string channel, string message, EventPriority? priority = null);
1414

1515
Task ReDispatchAsync(string channel, int count = 10, string order = "asc");
1616

src/Infrastructure/BotSharp.Abstraction/Utilities/Pagination.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using BotSharp.Abstraction.Infrastructures;
2+
using System.Diagnostics;
23

34
namespace BotSharp.Abstraction.Utilities;
45

6+
[DebuggerStepThrough]
57
public class Pagination : ICacheKey
68
{
79
private int _page;

src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisPublisher.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task BroadcastAsync(string channel, string message)
2121
await _subscriber.PublishAsync(channel, message);
2222
}
2323

24-
public async Task PublishAsync(string channel, string message, EventPriority? priority = null)
24+
public async Task<string?> PublishAsync(string channel, string message, EventPriority? priority = null)
2525
{
2626
var db = _redis.GetDatabase();
2727

@@ -34,7 +34,7 @@ public async Task PublishAsync(string channel, string message, EventPriority? pr
3434
if (CheckMessageExists(db, channel, "message", message))
3535
{
3636
_logger.LogError($"The message already exists {channel} {message}");
37-
return;
37+
return null;
3838
}
3939

4040
// Add a message to the stream, keeping only the latest 1 million messages
@@ -46,6 +46,8 @@ public async Task PublishAsync(string channel, string message, EventPriority? pr
4646
maxLength: 1000 * 10000);
4747

4848
_logger.LogInformation($"Published message {channel} {message} ({messageId})");
49+
50+
return messageId;
4951
}
5052

5153
private bool CheckMessageExists(IDatabase db, string channel, string fieldName, string desiredValue)

0 commit comments

Comments
 (0)