From 602d1dc721286fd53d7c0d39c8426bd55798c0c1 Mon Sep 17 00:00:00 2001 From: re-fort Date: Fri, 29 Dec 2017 09:59:32 +0900 Subject: [PATCH] :bulb: Refresh feeds after timeout It prevents creating duplicate issue/PR --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c967bb0..f78af13 100644 --- a/index.js +++ b/index.js @@ -10,6 +10,7 @@ let github = new Github() // let slack = new Slack({ token: process.env.SLACK_TOKEN }) let startUpTime = new Date().toISOString() +let timer = null let remote = { origin: { @@ -105,7 +106,8 @@ const setupUpstreamFeeder = () => { if (startUpTime < item.date.toISOString()) { Utility.log('I', `New commit on upstream repo: ${item.title}`) removeHeadFeeder() - setupHeadFeeder() + clearTimeout(timer) + timer = setTimeout(() => setupHeadFeeder(), 300000) } }) }