use unique p2p preflight idempotency keys
This commit is contained in:
@@ -216,11 +216,12 @@ 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.
|
||||
// EnsureP2P must execute on every preflight so it can repair subscriptions
|
||||
// and refresh a loaded topic. Use a fresh key instead of replaying an old
|
||||
// successful response from a previous load-test run.
|
||||
idempotencyKey := fmt.Sprintf("loadtest-p2p-%d-%s-%04d", time.Now().UnixNano(), source.Machine, source.Index)
|
||||
err := a.do(ctx, http.MethodPost, "/v1/im/conversations/p2p", source.Token,
|
||||
"",
|
||||
idempotencyKey,
|
||||
map[string]any{"peer_user_id": target.UserID}, &result)
|
||||
return &result, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user