flowhub / guv

Autoscaling for Heroku/AMQP
https://guvscale.com
MIT License
25 stars 6 forks source link

Get current workers from Heroku #193

Closed jonnor closed 7 years ago

jonnor commented 7 years ago

Previously we'd assume that the number current workers is what it was last changed to by guv, as stored in the history. This is not generally right. For instance when we first start, we don't have such a value, and we won't have it until we make a scaling decision. Furthermore it is possible for other things than guv to go on change something, so even after having made a scaling decision we can go out of sync. The canonical answer can be had by asking Heroku via the API. This doubles the number of requests we make per app. Which is normally not a problem, but for accounts which manage many apps this may cause to go over quota (since API quotas are per account).

jonnor commented 7 years ago

@bergie we have end-to-end tests against the real Heroku API

jonnor commented 7 years ago

@bergie the tests were failing (for good reasons), and the bugs found have been fixed. The tests which have been modified to include calls to mocks.Heroku.setCurrentWorkers illustrate the current coverage of the functionality touched here.