mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-19 20:58:32 +00:00
Max limit back to 2; make issues count more restrictive
This commit is contained in:
parent
74fe3982cc
commit
abac3f5cdb
@ -91,8 +91,10 @@ WHERE i.repo_id = r.repo_id;
|
|||||||
|
|
||||||
-- :name get-issues-count :? :1
|
-- :name get-issues-count :? :1
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM issues i, repositories r
|
FROM issues i
|
||||||
WHERE i.repo_id = :repo_id;
|
WHERE i.repo_id = :repo_id
|
||||||
|
AND i.confirm_hash is null
|
||||||
|
AND i.is_open = true;
|
||||||
|
|
||||||
-- :name update-repo-generic :! :n
|
-- :name update-repo-generic :! :n
|
||||||
/* :require [clojure.string :as string]
|
/* :require [clojure.string :as string]
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
(def ^:const label-name "bounty")
|
(def ^:const label-name "bounty")
|
||||||
|
|
||||||
|
;; TODO: Change max-limit, also defined in two places
|
||||||
|
;; TODO: Change max limit to 1000 after testing
|
||||||
|
(def max-issues-limit 2)
|
||||||
|
|
||||||
(defn has-bounty-label?
|
(defn has-bounty-label?
|
||||||
[issue]
|
[issue]
|
||||||
(let [labels (:labels issue)]
|
(let [labels (:labels issue)]
|
||||||
@ -47,13 +51,10 @@
|
|||||||
(issues/update-transaction-hash issue-id transaction-hash))))
|
(issues/update-transaction-hash issue-id transaction-hash))))
|
||||||
(log/debug "Issue already exists in DB, ignoring"))))
|
(log/debug "Issue already exists in DB, ignoring"))))
|
||||||
|
|
||||||
;; TODO: Change max-limit, also defined in two places
|
|
||||||
;; Note this is limits for total issues, need to take subset of this/join somehow
|
|
||||||
(defn maybe-add-bounty-for-issue [repo repo-id issue]
|
(defn maybe-add-bounty-for-issue [repo repo-id issue]
|
||||||
(let [res (issues/get-issues-count repo-id)
|
(let [res (issues/get-issues-count repo-id)
|
||||||
{count :count} res
|
{count :count} res
|
||||||
max-limit 10000
|
limit-reached? (> count max-issues-limit)
|
||||||
limit-reached? (> count max-limit)
|
|
||||||
_ (log/debug "*** get-issues-count" repo-id res count limit-reached?)]
|
_ (log/debug "*** get-issues-count" repo-id res count limit-reached?)]
|
||||||
(if limit-reached?
|
(if limit-reached?
|
||||||
(log/debug "Total issues for repo limit reached " repo count)
|
(log/debug "Total issues for repo limit reached " repo count)
|
||||||
@ -62,15 +63,13 @@
|
|||||||
|
|
||||||
;; We have a max-limit to ensure people can't add more issues and
|
;; We have a max-limit to ensure people can't add more issues and
|
||||||
;; drain bot account until we have economic design in place
|
;; 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]
|
(defn add-bounties-for-existing-issues [full-name]
|
||||||
(let [{repo-id :repo_id
|
(let [{repo-id :repo_id
|
||||||
owner :owner
|
owner :owner
|
||||||
repo :repo} (repos/get-repo full-name)
|
repo :repo} (repos/get-repo full-name)
|
||||||
issues (github/get-issues owner repo)
|
issues (github/get-issues owner repo)
|
||||||
bounty-issues (filter has-bounty-label? issues)
|
bounty-issues (filter has-bounty-label? issues)
|
||||||
limit 100
|
max-bounties (take max-issues-limit bounty-issues)]
|
||||||
max-bounties (take limit bounty-issues)]
|
|
||||||
(log/debug (str "adding bounties for" (count bounty-issues)
|
(log/debug (str "adding bounties for" (count bounty-issues)
|
||||||
" existing issues (total " (count bounty-issues) ")"))
|
" existing issues (total " (count bounty-issues) ")"))
|
||||||
(doall
|
(doall
|
||||||
|
Loading…
x
Reference in New Issue
Block a user