From 4f642d5a957c460fa293cbb7f1adcfac9f903779 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Thu, 1 Mar 2018 21:15:17 +0100
Subject: [PATCH] fix: optimise getAllRenovateBrnahces

Supply prefix in query and paginate.
---
 lib/platform/github/index.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index 71f9db1e90..0feb77f36d 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -328,8 +328,12 @@ async function branchExists(branchName) {
 
 async function getAllRenovateBranches(branchPrefix) {
   logger.trace('getAllRenovateBranches');
-  const allBranches = (await get(`repos/${config.repository}/git/refs/heads`))
-    .body;
+  const allBranches = (await get(
+    `repos/${config.repository}/git/refs/heads/${branchPrefix}`,
+    {
+      paginate: true,
+    }
+  )).body;
   return allBranches.reduce((arr, branch) => {
     if (branch.ref.indexOf(`refs/heads/${branchPrefix}`) === 0) {
       arr.push(branch.ref.substring('refs/heads/'.length));
-- 
GitLab