Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
http: remove dead code from internal/http.js
PR-URL: #36630
Refs: #32329
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
Lxxyx authored and aduh95 committed Jan 13, 2021
commit bae71f095530d6d2dd81a3906d7985c47c1e36ea
10 changes: 0 additions & 10 deletions lib/internal/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,25 @@ const {
Date,
DatePrototypeGetMilliseconds,
DatePrototypeToUTCString,
DatePrototypeValueOf,
} = primordials;

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;
}

function cache() {
const d = new Date();
nowCache = DatePrototypeValueOf(d);
utcCache = DatePrototypeToUTCString(d);
setUnrefTimeout(resetCache, 1000 - DatePrototypeGetMilliseconds(d));
}

function resetCache() {
nowCache = undefined;
utcCache = undefined;
}

Expand All @@ -55,7 +46,6 @@ function emitStatistics(statistics) {
module.exports = {
kOutHeaders: Symbol('kOutHeaders'),
kNeedDrain: Symbol('kNeedDrain'),
nowDate,
utcDate,
emitStatistics
};