summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/http.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/internal/http.js b/lib/internal/http.js
index 71e32498f3..2b9c948aee 100644
--- a/lib/internal/http.js
+++ b/lib/internal/http.js
@@ -1,20 +1,21 @@
'use strict';
-const timers = require('timers');
+const { setUnrefTimeout } = require('internal/timers');
var dateCache;
function utcDate() {
if (!dateCache) {
const d = new Date();
dateCache = d.toUTCString();
- timers.enroll(utcDate, 1000 - d.getMilliseconds());
- timers._unrefActive(utcDate);
+
+ setUnrefTimeout(resetCache, 1000 - d.getMilliseconds());
}
return dateCache;
}
-utcDate._onTimeout = function() {
+
+function resetCache() {
dateCache = undefined;
-};
+}
function ondrain() {
if (this._httpMessage) this._httpMessage.emit('drain');