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
|
||||
SELECT COUNT(*)
|
||||
FROM issues i, repositories r
|
||||
WHERE i.repo_id = :repo_id;
|
||||
FROM issues i
|
||||
WHERE i.repo_id = :repo_id
|
||||
AND i.confirm_hash is null
|
||||
AND i.is_open = true;
|
||||
|
||||
-- :name update-repo-generic :! :n
|
||||
/* :require [clojure.string :as string]
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
(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?
|
||||
[issue]
|
||||
(let [labels (:labels issue)]
|
||||
|
@ -47,13 +51,10 @@
|
|||
(issues/update-transaction-hash issue-id transaction-hash))))
|
||||
(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]
|
||||
(let [res (issues/get-issues-count repo-id)
|
||||
{count :count} res
|
||||
max-limit 10000
|
||||
limit-reached? (> count max-limit)
|
||||
limit-reached? (> count max-issues-limit)
|
||||
_ (log/debug "*** get-issues-count" repo-id res count limit-reached?)]
|
||||
(if limit-reached?
|
||||
(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
|
||||
;; 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)
|
||||
limit 100
|
||||
max-bounties (take limit bounty-issues)]
|
||||
max-bounties (take max-issues-limit bounty-issues)]
|
||||
(log/debug (str "adding bounties for" (count bounty-issues)
|
||||
" existing issues (total " (count bounty-issues) ")"))
|
||||
(doall
|
||||
|
|
Loading…
Reference in New Issue