Update Notification Handler to Send Notifications Asynchronously
- Modified the Send method in the NotificationHandler to dispatch notifications asynchronously by using a goroutine, improving responsiveness and allowing the handler to return immediately after initiating the send process. - This change enhances the user experience by not blocking the request while the notification is being sent, ensuring smoother operation of the API.
This commit is contained in:
@@ -50,7 +50,7 @@ func (h *NotificationHandler) Send(c echo.Context) error {
|
||||
}
|
||||
|
||||
// Send notification
|
||||
h.service.Send(context.Background(), &req)
|
||||
go h.service.Send(context.Background(), &req)
|
||||
|
||||
return response.Created(c, nil, "Notification sent successfully")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user