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.
This commit is contained in:
n.nakhostin
2025-09-20 16:56:23 +03:30
parent 9037cb5917
commit ab6eb3b3ed
+1 -3
View File
@@ -45,9 +45,7 @@ func (h *NotificationHandler) Send(c echo.Context) error {
} }
// Send notification // Send notification
if err := h.service.Send(c.Request().Context(), &req); err != nil { go h.service.Send(c.Request().Context(), &req)
return response.InternalServerError(c, "Failed to send notification")
}
return response.Created(c, nil, "Notification sent successfully") return response.Created(c, nil, "Notification sent successfully")
} }