From ab6eb3b3ed77651d61c488dfd15f98f8326c6817 Mon Sep 17 00:00:00 2001 From: "n.nakhostin" Date: Sat, 20 Sep 2025 16:56:23 +0330 Subject: [PATCH] Refactor Notification Sending Logic to Use Goroutines - Updated the Send method in NotificationHandler to send notifications asynchronously using goroutines, improving responsiveness and performance. - Removed synchronous error handling for notification sending, allowing the API to return a success response immediately while processing the notification in the background. --- internal/notification/handler.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/notification/handler.go b/internal/notification/handler.go index e8b754d..18decb8 100644 --- a/internal/notification/handler.go +++ b/internal/notification/handler.go @@ -45,9 +45,7 @@ func (h *NotificationHandler) Send(c echo.Context) error { } // Send notification - if err := h.service.Send(c.Request().Context(), &req); err != nil { - return response.InternalServerError(c, "Failed to send notification") - } + go h.service.Send(c.Request().Context(), &req) return response.Created(c, nil, "Notification sent successfully") }