From 80d7d92ebdad1269aa11228e44c24bd60ccb45c4 Mon Sep 17 00:00:00 2001 From: Patrick Britton Date: Wed, 4 Feb 2026 12:35:00 -0600 Subject: [PATCH] fix(notifications): use background context for async notifications --- go-backend/internal/handlers/post_handler.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/go-backend/internal/handlers/post_handler.go b/go-backend/internal/handlers/post_handler.go index 0ac877f..111e98a 100644 --- a/go-backend/internal/handlers/post_handler.go +++ b/go-backend/internal/handlers/post_handler.go @@ -497,12 +497,13 @@ func (h *PostHandler) SavePost(c *gin.Context) { // Send push notification to post author go func() { - post, err := h.postRepo.GetPostByID(c.Request.Context(), postID, userIDStr.(string)) + bgCtx := context.Background() + post, err := h.postRepo.GetPostByID(bgCtx, postID, userIDStr.(string)) if err != nil || post.AuthorID.String() == userIDStr.(string) { return // Don't notify self } - actor, err := h.userRepo.GetProfileByID(c.Request.Context(), userIDStr.(string)) + actor, err := h.userRepo.GetProfileByID(bgCtx, userIDStr.(string)) if err != nil || h.notificationService == nil { return } @@ -521,7 +522,7 @@ func (h *PostHandler) SavePost(c *gin.Context) { "post_type": postType, } h.notificationService.CreateNotification( - c.Request.Context(), + context.Background(), post.AuthorID.String(), userIDStr.(string), "save",