status-im / open-bounty

Enable communities to distribute funds to push their cause forward.
https://openbounty.status.im/
GNU Affero General Public License v3.0
118 stars 36 forks source link

fix #434: dont fetch price-info too often #435

Closed martinklepsch closed 6 years ago

martinklepsch commented 6 years ago

QA NOTES This change has no user facing effect. It changes how we fetch price data for our background jobs. Previously everytime we wanted to know the USD equivalent of some bounties tokens we made a request to some API.

This caused us to get rate limited as described in #434.

This change modifies our code so that we cache the conversion rate for 5 minutes. If you watch the logs on testing you should see log messages like

:SNT: Getting price-data from CoinMarketCap (token-id status)

appearing once every 10 minutes or so. You should not see these messages in quick succession.

vitvly commented 6 years ago

Why do we use edn/read-string instead of read-string?

martinklepsch commented 6 years ago

@siphiuel try this in a repl:

(read-string "#=(clojure.java.shell/sh \"echo\" \"hi\")")

see https://clojuredocs.org/clojure.core/read#example-542692d5c026201cdc327056

vitvly commented 6 years ago

@martinklepsch I see, thanks.

churik commented 6 years ago

Environments

Tested functionality