mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
f94eec0218
A sort-of follow-up to https://github.com/nodejs/node/pull/17704, this removes the last internal use of enroll(). PR-URL: https://github.com/nodejs/node/pull/17800 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
29 lines
495 B
JavaScript
29 lines
495 B
JavaScript
'use strict';
|
|
|
|
const { setUnrefTimeout } = require('internal/timers');
|
|
|
|
var dateCache;
|
|
function utcDate() {
|
|
if (!dateCache) {
|
|
const d = new Date();
|
|
dateCache = d.toUTCString();
|
|
|
|
setUnrefTimeout(resetCache, 1000 - d.getMilliseconds());
|
|
}
|
|
return dateCache;
|
|
}
|
|
|
|
function resetCache() {
|
|
dateCache = undefined;
|
|
}
|
|
|
|
function ondrain() {
|
|
if (this._httpMessage) this._httpMessage.emit('drain');
|
|
}
|
|
|
|
module.exports = {
|
|
outHeadersKey: Symbol('outHeadersKey'),
|
|
ondrain,
|
|
utcDate
|
|
};
|