mirror of
https://github.com/github/codeql-action.git
synced 2025-12-30 19:20:08 +08:00
17 lines
501 B
JavaScript
17 lines
501 B
JavaScript
'use strict';
|
|
const timers = require('node:timers');
|
|
|
|
Object.assign(exports, timers);
|
|
exports.now = Date.now;
|
|
|
|
// Any delay larger than this value is ignored by Node.js, with a delay of `1`
|
|
// used instead. See <https://nodejs.org/api/timers.html#settimeoutcallback-delay-args>.
|
|
const MAX_DELAY = (2 ** 31) - 1;
|
|
|
|
function setCappedTimeout(callback, delay) {
|
|
const safeDelay = Math.min(delay, MAX_DELAY);
|
|
return timers.setTimeout(callback, safeDelay);
|
|
}
|
|
|
|
exports.setCappedTimeout = setCappedTimeout;
|