@@ -49,7 +49,7 @@ import {AxiosRequestConfig, AxiosResponse, AxiosHeaders, AxiosError, isAxiosErro
4949export { RequestFile } from '../model/models' ;
5050
5151const revision = "2026-04-15" ;
52- const userAgent = "klaviyo-api-node/22.0.0 " ;
52+ const userAgent = "klaviyo-api-node/22.0.1 " ;
5353
5454export class RetryWithExponentialBackoff {
5555
@@ -74,16 +74,16 @@ export class RetryWithExponentialBackoff {
7474 }
7575
7676 async requestWithRetry ( config : AxiosRequestConfig ) : Promise < AxiosResponse > {
77- let lastRequestRetryAfter
78- let lastRequestTimestamp
77+ let lastRequestRetryAfterSec
78+ let lastRequestTimestampMs
7979 let attempt = 0
8080 let iteration = 0
8181
8282 while ( true ) {
8383 try {
84- const currentTime = Date . now ( )
85- const retryAfterValueLapsed = ( ! lastRequestRetryAfter ||
86- currentTime - lastRequestTimestamp > lastRequestRetryAfter )
84+ const currentTimeMs = Date . now ( )
85+ const retryAfterValueLapsed = ( ! lastRequestRetryAfterSec ||
86+ currentTimeMs - lastRequestTimestampMs > lastRequestRetryAfterSec * 1000 )
8787 if ( retryAfterValueLapsed ) {
8888 attempt += 1
8989
@@ -101,11 +101,11 @@ export class RetryWithExponentialBackoff {
101101 }
102102
103103 const responseHeaders = headers || { }
104- lastRequestRetryAfter = responseHeaders [ 'Retry-After ' ]
105- if ( lastRequestRetryAfter ) {
106- lastRequestRetryAfter = parseInt ( lastRequestRetryAfter , 10 )
104+ lastRequestRetryAfterSec = responseHeaders [ 'retry-after ' ]
105+ if ( lastRequestRetryAfterSec ) {
106+ lastRequestRetryAfterSec = parseInt ( lastRequestRetryAfterSec , 10 )
107107 }
108- lastRequestTimestamp = Date . now ( )
108+ lastRequestTimestampMs = Date . now ( )
109109 }
110110 const sleepSeconds = this . exponentialBackoff ( iteration )
111111 await this . sleep ( sleepSeconds )
0 commit comments