Comments (3)
After looking through the code, I think the reason may be slightly different:
If I have 5 dynos running, but only 4 active, when the downscale to 4 command is issued which of the 5 dynos is removed? Is it just random?
from autoscaler.
Here's what I ended up doing, though a bit hacky:
require 'autoscaler/heroku_scaler'
require 'sidekiq/api'
class SafeHerokuScaler < Autoscaler::HerokuScaler
def workers=(n)
unknown = false
current = @workers.counter{unknown = true; 1}
if n < current && ::Sidekiq::Workers.new.map {|pid, _, _| pid}.uniq.select { |pid| pid.include?(type) }.size > 0
p "Scaling #{type} to #{n} -- REJECTED"
return
end
if n != current || unknown
p "Scaling #{type} to #{n} -- ACCEPTED"
heroku_set_workers(n)
@workers.counter = n
end
end
end
Basically, as long as jobs are running for that type it will only issue upscales. Let me know if you think it's worth a pull request.
from autoscaler.
I pretty much counted on SideKiq retries for this, but it may depend on the exact workload.
from autoscaler.
Related Issues (20)
- Handle heroku api downtimes HOT 1
- Project requires more active maintainer HOT 3
- 403 Forbidden when scaling worker HOT 1
- support for Sidekiq 3.0.0 HOT 4
- undefined method `async' for nil:NilClass HOT 2
- Autoscaling multiple workers HOT 1
- support for Sidekiq 3.1 and 3.2 HOT 2
- Upgrade to platform-api HOT 2
- time to release a new version? HOT 15
- Handling multiple queues with a single worker dyno HOT 4
- How to use LinearScalingStrategy? HOT 1
- Project maintainer should also be a user HOT 3
- Error when scaling down - Unable to create thread HOT 10
- don't want to use set_initial_workers HOT 5
- Sidekiq 5 support? HOT 2
- Heroku platform API error HOT 3
- Rename ENV vars HOT 4
- Autoscaler is passaing Incorrect Authentication "type" param to platform-api HOT 4
- ThreadError: can't alloc thread HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autoscaler.