From 2bb979668cd2a6ec5804165df52e5955c1a9b31b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 27 Jan 2025 00:31:15 +0800 Subject: [PATCH] :bug: Trying to fix bugs --- pkg/internal/services/posts.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index ebe17a5..67dd1ba 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -513,10 +513,10 @@ func updatePostAttachmentVisibility(item models.Post) error { } pc := pproto.NewAttachmentServiceClient(conn) - _, err = pc.UpdateVisibility(context.Background(), &pproto.UpdateVisibilityRequest{ - Rid: lo.Map(val, func(item string, _ int) string { - return item - }), + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + resp, err := pc.UpdateVisibility(ctx, &pproto.UpdateVisibilityRequest{ + Rid: val, UserId: lo.ToPtr(uint64(*item.Publisher.AccountID)), IsIndexable: item.Visibility == models.PostVisibilityAll, }) @@ -525,7 +525,9 @@ func updatePostAttachmentVisibility(item models.Post) error { return err } - log.Debug().Any("attachments", val).Msg("Post attachment visibility updated.") + log.Debug().Any("attachments", val).Int32("count", resp.Count).Msg("Post attachment visibility updated.") + } else { + log.Debug().Any("attachments", val).Msg("Post attachment visibility update skipped...") } return nil