6de2455917
- Added GLOBAL_MARKETS_TITLE to all translation files - Updated footer with 12 markets (4 active + 8 upcoming) - Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi - Built and deployed to production - CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
22 lines
888 B
JavaScript
22 lines
888 B
JavaScript
import { timing } from "./timing";
|
|
export const setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
|
|
if (timeoutInMs) {
|
|
return timing.setTimeout(() => {
|
|
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
if (throwOnRequestTimeout) {
|
|
const error = Object.assign(new Error(msg), {
|
|
name: "TimeoutError",
|
|
code: "ETIMEDOUT",
|
|
});
|
|
req.destroy(error);
|
|
reject(error);
|
|
}
|
|
else {
|
|
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
logger?.warn?.(msg);
|
|
}
|
|
}, timeoutInMs);
|
|
}
|
|
return -1;
|
|
};
|