increased payout timeout
This commit is contained in:
@@ -106,12 +106,23 @@ func (c *Client) sendTokenization(ctx context.Context, req CardTokenizeRequest)
|
||||
zap.String("masked_pan", MaskPAN(req.Card.PAN)),
|
||||
)
|
||||
|
||||
logRequestDeadline(c.logger, ctx, url)
|
||||
start := time.Now()
|
||||
resp, err := c.client.Do(httpReq)
|
||||
duration := time.Since(start)
|
||||
if err != nil {
|
||||
observeRequest(outcomeNetworkError, duration)
|
||||
c.logger.Warn("Monetix tokenization request failed", zap.Error(err))
|
||||
fields := []zap.Field{
|
||||
zap.String("url", url),
|
||||
zap.Error(err),
|
||||
}
|
||||
if ctxErr := ctx.Err(); ctxErr != nil {
|
||||
fields = append(fields, zap.NamedError("ctx_error", ctxErr))
|
||||
}
|
||||
if deadline, ok := ctx.Deadline(); ok {
|
||||
fields = append(fields, zap.Time("deadline", deadline), zap.Duration("time_until_deadline", time.Until(deadline)))
|
||||
}
|
||||
c.logger.Warn("Monetix tokenization request failed", fields...)
|
||||
return nil, merrors.Internal("monetix tokenization request failed: " + err.Error())
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
@@ -221,11 +232,23 @@ func (c *Client) send(ctx context.Context, req any, path string, dispatchLog fun
|
||||
dispatchLog()
|
||||
}
|
||||
|
||||
logRequestDeadline(c.logger, ctx, url)
|
||||
start := time.Now()
|
||||
resp, err := c.client.Do(httpReq)
|
||||
duration := time.Since(start)
|
||||
if err != nil {
|
||||
observeRequest(outcomeNetworkError, duration)
|
||||
fields := []zap.Field{
|
||||
zap.String("url", url),
|
||||
zap.Error(err),
|
||||
}
|
||||
if ctxErr := ctx.Err(); ctxErr != nil {
|
||||
fields = append(fields, zap.NamedError("ctx_error", ctxErr))
|
||||
}
|
||||
if deadline, ok := ctx.Deadline(); ok {
|
||||
fields = append(fields, zap.Time("deadline", deadline), zap.Duration("time_until_deadline", time.Until(deadline)))
|
||||
}
|
||||
c.logger.Warn("Monetix request failed", fields...)
|
||||
return nil, merrors.Internal("monetix request failed: " + err.Error())
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
@@ -288,3 +311,23 @@ func clearSignature(req any) (func(string), error) {
|
||||
return nil, merrors.Internal("unsupported monetix payload type for signing")
|
||||
}
|
||||
}
|
||||
|
||||
func logRequestDeadline(logger *zap.Logger, ctx context.Context, url string) {
|
||||
if logger == nil {
|
||||
return
|
||||
}
|
||||
if ctx == nil {
|
||||
logger.Info("Monetix request context is nil", zap.String("url", url))
|
||||
return
|
||||
}
|
||||
deadline, ok := ctx.Deadline()
|
||||
if !ok {
|
||||
logger.Info("Monetix request context has no deadline", zap.String("url", url))
|
||||
return
|
||||
}
|
||||
logger.Info("Monetix request context deadline",
|
||||
zap.String("url", url),
|
||||
zap.Time("deadline", deadline),
|
||||
zap.Duration("time_until_deadline", time.Until(deadline)),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user