Skip to content

Commit 91ed6ac

Browse files
emplam27hackerwins
authored andcommitted
Add concurrency sync benchmark test (#1224)
This commit added benchmark tests to evaluate performance during concurrent synchronization with multiple clients. It also improved benchmark utilities for streamlined setup of servers, clients, and documents.
1 parent 8aae220 commit 91ed6ac

9 files changed

+583
-408
lines changed

pkg/webhook/client.go

+5
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ func (c *Client[Req, Res]) Send(
122122
return &res, status, nil
123123
}
124124

125+
// Close closes the httpClient.
126+
func (c *Client[Req, Res]) Close() {
127+
c.httpClient.CloseIdleConnections()
128+
}
129+
125130
// buildRequest creates a new HTTP POST request with the appropriate headers.
126131
func (c *Client[Req, Res]) buildRequest(
127132
ctx context.Context,

server/backend/backend.go

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ func (b *Backend) Shutdown() error {
222222

223223
b.Background.Close()
224224

225+
b.AuthWebhookClient.Close()
225226
b.EventWebhookManager.Close()
226227

227228
if err := b.MsgBroker.Close(); err != nil {

server/backend/webhook/manager.go

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ func (m *Manager) Send(ctx context.Context, info types.EventWebhookInfo) error {
7676
// Close closes the event webhook manager. This will wait for flushing remain debouncing events
7777
func (m *Manager) Close() {
7878
m.limiter.Close()
79+
80+
// NOTE(hackerwins): It is not good to close the webhook client here
81+
// because it is created from outside.
82+
m.webhookClient.Close()
7983
}
8084

8185
// SendWebhook sends the webhook event using the provided client.

0 commit comments

Comments
 (0)