🐛 Fix subscription notification send twice
This commit is contained in:
parent
a5dae37525
commit
ec3961d546
@ -216,13 +216,6 @@ public class PostController(
|
|||||||
return BadRequest(err.Message);
|
return BadRequest(err.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
using var scope = factory.CreateScope();
|
|
||||||
var subs = scope.ServiceProvider.GetRequiredService<PublisherSubscriptionService>();
|
|
||||||
await subs.NotifySubscriberPost(post);
|
|
||||||
});
|
|
||||||
|
|
||||||
als.CreateActionLogFromRequest(
|
als.CreateActionLogFromRequest(
|
||||||
ActionLogType.PostCreate,
|
ActionLogType.PostCreate,
|
||||||
new Dictionary<string, object> { { "post_id", post.Id } }, Request
|
new Dictionary<string, object> { { "post_id", post.Id } }, Request
|
||||||
|
@ -69,7 +69,7 @@ public class PublisherSubscriptionService(
|
|||||||
|
|
||||||
// Notify each subscriber
|
// Notify each subscriber
|
||||||
var notifiedCount = 0;
|
var notifiedCount = 0;
|
||||||
foreach (var subscription in subscribers.GroupBy(s => s.AccountId).Select(g => g.First()))
|
foreach (var subscription in subscribers.DistinctBy(s => s.AccountId))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user