Add try-catch to update-confirm-hash, update-watch-hash,

deploy-pending-contracts
This commit is contained in:
Vitaliy Vlasov 2018-04-12 13:56:20 +03:00
parent 52edd4e207
commit 893a0bdffb
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
1 changed files with 19 additions and 10 deletions

View File

@ -93,7 +93,10 @@
owner-address :owner_address owner-address :owner_address
repo :repo} (db-bounties/pending-contracts)] repo :repo} (db-bounties/pending-contracts)]
(log/infof "issue %s: Trying to re-deploy failed bounty contract deployment" issue-id) (log/infof "issue %s: Trying to re-deploy failed bounty contract deployment" issue-id)
(bounties/deploy-contract owner owner-address repo issue-id issue-number)))) (try
(bounties/deploy-contract owner owner-address repo issue-id issue-number)
(catch Throwable ex
(log/errorf ex "issue %s: deploy-pending-contracts exception:" issue-id))))))
(defn self-sign-bounty (defn self-sign-bounty
"Walks through all issues eligible for bounty payout and signs corresponding transaction" "Walks through all issues eligible for bounty payout and signs corresponding transaction"
@ -147,11 +150,14 @@
(doseq [{issue-id :issue_id (doseq [{issue-id :issue_id
execute-hash :execute_hash} (db-bounties/pending-payouts)] execute-hash :execute_hash} (db-bounties/pending-payouts)]
(log/infof "issue %s: pending payout: %s" issue-id execute-hash) (log/infof "issue %s: pending payout: %s" issue-id execute-hash)
(when-let [receipt (eth/get-transaction-receipt execute-hash)] (try
(log/infof "issue %s: execution receipt for issue " issue-id receipt) (when-let [receipt (eth/get-transaction-receipt execute-hash)]
(when-let [confirm-hash (multisig/find-confirmation-tx-id receipt)] (log/infof "issue %s: execution receipt for issue " issue-id receipt)
(log/infof "issue %s: confirm hash:" issue-id confirm-hash) (when-let [confirm-hash (multisig/find-confirmation-tx-id receipt)]
(db-bounties/update-confirm-hash issue-id confirm-hash))))) (log/infof "issue %s: confirm hash:" issue-id confirm-hash)
(db-bounties/update-confirm-hash issue-id confirm-hash)))
(catch Throwable ex
(log/errorf ex "issue %s: update-confirm-hash exception:" issue-id)))))
(log/info "Exit update-confirm-hash")) (log/info "Exit update-confirm-hash"))
@ -162,8 +168,11 @@
(doseq [{issue-id :issue_id (doseq [{issue-id :issue_id
watch-hash :watch_hash} (db-bounties/pending-watch-calls)] watch-hash :watch_hash} (db-bounties/pending-watch-calls)]
(log/infof "issue %s: pending watch call %s" issue-id watch-hash) (log/infof "issue %s: pending watch call %s" issue-id watch-hash)
(when-let [receipt (eth/get-transaction-receipt watch-hash)] (try
(db-bounties/update-watch-hash issue-id nil))))) (when-let [receipt (eth/get-transaction-receipt watch-hash)]
(db-bounties/update-watch-hash issue-id nil))
(catch Throwable ex
(log/errorf ex "issue %s: update-watch-hash exception:" issue-id))))))
(defn older-than-3h? (defn older-than-3h?
@ -238,7 +247,7 @@
multisig contract. Will be called periodically for all open bounty multisig contract. Will be called periodically for all open bounty
contracts." contracts."
[issue-id bounty-addr watch-hash] [issue-id bounty-addr watch-hash]
#_(log/info "In update-bounty-token-balances for issue" issue-id) (log/info "In update-bounty-token-balances for issue" issue-id)
(doseq [[tla token-data] (token-data/as-map)] (doseq [[tla token-data] (token-data/as-map)]
(try (try
(let [balance (multisig/token-balance bounty-addr tla)] (let [balance (multisig/token-balance bounty-addr tla)]
@ -253,7 +262,7 @@
(db-bounties/update-watch-hash issue-id hash))))))) (db-bounties/update-watch-hash issue-id hash)))))))
(catch Throwable ex (catch Throwable ex
(log/error ex "bounty %s: update-bounty-token-balances exception" bounty-addr)))) (log/error ex "bounty %s: update-bounty-token-balances exception" bounty-addr))))
#_(log/info "Exit update-bounty-token-balances")) (log/info "Exit update-bounty-token-balances"))
(defn update-contract-internal-balances (defn update-contract-internal-balances