From 58f6498cc4b0f8fb059bfcca79f65901d633817d Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 17 Jun 2019 08:31:36 +0200 Subject: [PATCH] =?UTF-8?q?fix(github):=20don=E2=80=99t=20dump=20request?= =?UTF-8?q?=20stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/platform/github/gh-got-wrapper.js | 26 --------------------- lib/platform/github/index.js | 1 - test/platform/github/gh-got-wrapper.spec.js | 1 - 3 files changed, 28 deletions(-) diff --git a/lib/platform/github/gh-got-wrapper.js b/lib/platform/github/gh-got-wrapper.js index d963097d66..11dac1623a 100644 --- a/lib/platform/github/gh-got-wrapper.js +++ b/lib/platform/github/gh-got-wrapper.js @@ -5,8 +5,6 @@ const pAll = require('p-all'); const got = require('../../util/got'); const { maskToken } = require('../../util/mask'); -let stats = {}; - const hostType = 'github'; let baseUrl = 'https://api.github.com/'; @@ -23,9 +21,6 @@ async function get(path, options, okToRetry = true) { opts.baseUrl = opts.baseUrl.replace('/v3/', '/'); } logger.trace(`${method.toUpperCase()} ${path}`); - stats.requests = (stats.requests || []).concat([ - method.toUpperCase() + ' ' + path, - ]); try { if (global.appMode) { const appAccept = 'application/vnd.github.machine-man-preview+json'; @@ -44,10 +39,6 @@ async function get(path, options, okToRetry = true) { } } const res = await got(path, opts); - if (res && res.headers) { - stats.rateLimit = res.headers['x-ratelimit-limit']; - stats.rateLimitRemaining = res.headers['x-ratelimit-remaining']; - } if (opts.paginate) { // Check if result is paginated const pageLimit = opts.pageLimit || 10; @@ -165,23 +156,6 @@ get.setAppMode = function setAppMode() { // no-op }; -get.reset = function reset() { - // istanbul ignore if - if (stats.requests && stats.requests.length > 1) { - logger.info( - { - rateLimit: parseInt(stats.rateLimit, 10), - requestCount: stats.requests.length, - rateLimitRemaining: parseInt(stats.rateLimitRemaining, 10), - }, - 'Request stats' - ); - stats.requests.sort(); - logger.debug({ requests: stats.requests }, 'All requests'); - stats = {}; - } -}; - get.setBaseUrl = u => { baseUrl = u; }; diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index fd66d09f06..b8f6c3106b 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -135,7 +135,6 @@ function cleanRepo() { config.storage.cleanRepo(); } // In theory most of this isn't necessary. In practice.. - get.reset(); config = {}; } diff --git a/test/platform/github/gh-got-wrapper.spec.js b/test/platform/github/gh-got-wrapper.spec.js index a219719267..179642b79a 100644 --- a/test/platform/github/gh-got-wrapper.spec.js +++ b/test/platform/github/gh-got-wrapper.spec.js @@ -8,7 +8,6 @@ jest.mock('delay'); describe('platform/gh-got-wrapper', () => { beforeEach(() => { jest.resetAllMocks(); - get.reset(); delete global.appMode; delay.mockImplementation(() => Promise.resolve()); }); -- GitLab