fix loadtest p2p preflight replay

This commit is contained in:
richjohnrambo
2026-09-27 13:35:17 +08:00
parent f9f7321b11
commit 8280ac5987
+4 -1
View File
@@ -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
}