From 8280ac598791ea99623fcc1d1e601c4c398bd926 Mon Sep 17 00:00:00 2001 From: richjohnrambo Date: Sun, 27 Sep 2026 13:35:17 +0800 Subject: [PATCH] fix loadtest p2p preflight replay --- loadtest/im-pressure/httpapi.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/loadtest/im-pressure/httpapi.go b/loadtest/im-pressure/httpapi.go index df2c20b..d3363f6 100644 --- a/loadtest/im-pressure/httpapi.go +++ b/loadtest/im-pressure/httpapi.go @@ -216,8 +216,11 @@ type p2pResponse struct { func (a *apiClient) ensureP2P(ctx context.Context, source, target AccountRecord) (*p2pResponse, error) { var result p2pResponse + // EnsureP2P is itself idempotent and must execute on every preflight so it + // can repair subscriptions and refresh a loaded topic. A stable HTTP + // idempotency key would replay an old response and skip that repair. err := a.do(ctx, http.MethodPost, "/v1/im/conversations/p2p", source.Token, - fmt.Sprintf("loadtest-p2p-%s-%04d", source.Machine, source.Index), + "", map[string]any{"peer_user_id": target.UserID}, &result) return &result, err }