From 339db9092d2597e52c88f0d02b3ec08eb37f32f0 Mon Sep 17 00:00:00 2001 From: dsx137 <70027572+dsx137@users.noreply.github.com> Date: Fri, 21 Aug 2026 19:26:57 +0800 Subject: [PATCH] refactor(core): simplify asynchronous webhook enqueueing --- pkg/common/webhook/http_client.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/common/webhook/http_client.go b/pkg/common/webhook/http_client.go index 607c5ba13..3051c41c8 100644 --- a/pkg/common/webhook/http_client.go +++ b/pkg/common/webhook/http_client.go @@ -17,6 +17,8 @@ package webhook import ( "context" "encoding/json" + "net/http" + "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" @@ -25,7 +27,6 @@ import ( "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/mq/memamq" "github.com/openimsdk/tools/utils/httputil" - "net/http" ) type Client struct { @@ -62,13 +63,7 @@ func (c *Client) SyncPost(ctx context.Context, command string, req callbackstruc func (c *Client) AsyncPost(ctx context.Context, command string, req callbackstruct.CallbackReq, resp callbackstruct.CallbackResp, after *config.AfterConfig) { if after.Enable { - if err := c.queue.NotWaitPush(func() { - if err := c.post(ctx, command, req, resp, after.Timeout); err != nil { - log.ZError(ctx, "async webhook post failed", err, "url", c.url, "command", command) - } - }); err != nil { - log.ZError(ctx, "async webhook enqueue failed", err, "url", c.url, "command", command) - } + c.queue.Push(func() { c.post(ctx, command, req, resp, after.Timeout) }) } }