From 9156f430b5889623b5a8ebef9059ec7212a31b8a Mon Sep 17 00:00:00 2001 From: ZiJian Liu Date: Fri, 25 Dec 2020 22:22:33 +0800 Subject: [PATCH] http: remove dead code from internal/http.js PR-URL: https://github.com/nodejs/node/pull/36630 Refs: https://github.com/nodejs/node/pull/32329 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- lib/internal/http.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/internal/http.js b/lib/internal/http.js index 0065f93fd896f0..081f13c0b95e91 100644 --- a/lib/internal/http.js +++ b/lib/internal/http.js @@ -11,14 +11,8 @@ const { const { setUnrefTimeout } = require('internal/timers'); const { PerformanceEntry, notify } = internalBinding('performance'); -let nowCache; let utcCache; -function nowDate() { - if (!nowCache) cache(); - return nowCache; -} - function utcDate() { if (!utcCache) cache(); return utcCache; @@ -26,13 +20,11 @@ function utcDate() { function cache() { const d = new Date(); - nowCache = DatePrototypeValueOf(d); - utcCache = DatePrototypeToUTCString(d); - setUnrefTimeout(resetCache, 1000 - DatePrototypeGetMilliseconds(d)); + utcCache = d.toUTCString(); + setUnrefTimeout(resetCache, 1000 - d.getMilliseconds()); } function resetCache() { - nowCache = undefined; utcCache = undefined; } @@ -55,7 +47,6 @@ function emitStatistics(statistics) { module.exports = { kOutHeaders: Symbol('kOutHeaders'), kNeedDrain: Symbol('kNeedDrain'), - nowDate, utcDate, emitStatistics };