SaintAngeLs / distributed_minispace

Microservices based Social Network -- Distributed .Net Blazor solution. MiniSpace is a microservices-based social network designed to enhance student life. Built with .NET Blazor, it enables event management, social interactions, and administrative oversight, providing a comprehensive platform for students and event organizers.
https://minispace.itsharppro.com
Apache License 2.0
5 stars 0 forks source link

Why I've got so many notifications? #233

Closed an2508374 closed 1 month ago

an2508374 commented 1 month ago

I've observed I have 8184 items in my notification panel. Each of them appeared today, only after signing up and showed interest in one event and creating the test one.

I'm not sure that this situation is intended.

1 2 3

eggwhat commented 1 month ago

I have the same problem.

SaintAngeLs commented 1 month ago

This issue is related to start serving all the unrouted events published in the queue in server rabbit. I will provide more competent implementation of the cleaner service after 17:00.

SaintAngeLs commented 1 month ago

The issue was related to creating multiple objects in Event: I previously used the data from the created 'notification' object passing it to NotificationCreated by it's values like 'notification.notificationId' , which created 2 NotificationCreated Events as the result.

  var notification = new Notification(
                notificationId: Guid.NewGuid(),
                userId: eventArgs.StudentId,
                message: notificationMessage,
                status: NotificationStatus.Unread,
                createdAt: DateTime.UtcNow,
                updatedAt: null,
                relatedEntityId: eventArgs.EventId,
                eventType: NotificationEventType.StudentCancelledInterestInEvent,
                details: detailsHtml
            );

            studentNotifications.AddNotification(notification);
            await _studentNotificationsRepository.UpdateAsync(studentNotifications);

            var notificationCreatedEvent = new NotificationCreated(
                notificationId:  Guid.NewGuid(),
                userId: eventArgs.StudentId,
                message: notificationMessage,
                createdAt: DateTime.UtcNow,
                eventType: NotificationEventType.StudentCancelledInterestInEvent.ToString(),
                relatedEntityId: eventArgs.Even