From a912de13c1f28d24bf97d36b6072f991e9f4cf04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Thor=C3=A9n?= Date: Tue, 31 Oct 2017 10:52:52 -0500 Subject: [PATCH] Limit max issues to 2 --- src/clj/commiteth/bounties.clj | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/clj/commiteth/bounties.clj b/src/clj/commiteth/bounties.clj index 5f589af..ad5cd61 100644 --- a/src/clj/commiteth/bounties.clj +++ b/src/clj/commiteth/bounties.clj @@ -48,17 +48,21 @@ (issues/update-transaction-hash issue-id transaction-hash)))) (log/debug "Issue already exists in DB, ignoring")))) - +;; We have a max-limit to ensure people can't add more issues and +;; drain bot account until we have economic design in place +;; TODO(oskarth): Update max-limit to 100 (defn add-bounties-for-existing-issues [full-name] (let [{repo-id :repo_id owner :owner repo :repo} (repos/get-repo full-name) issues (github/get-issues owner repo) - bounty-issues (filter has-bounty-label? issues)] - (log/debug "adding bounties for" - (count bounty-issues) " existing issues") + bounty-issues (filter has-bounty-label? issues) + limit 2 + max-bounties (take limit bounty-issues)] + (log/debug (str "adding bounties for" (count bounty-issues) + " existing issues (total " (count bounty-issues) ")")) (doall - (map (partial add-bounty-for-issue repo repo-id) bounty-issues)))) + (map (partial add-bounty-for-issue repo repo-id) max-bounties)))) (defn update-bounty-comment-image [issue-id owner repo issue-number contract-address eth-balance eth-balance-str tokens]