mirror of
https://github.com/spaytac/orbiter.git
synced 2026-01-21 21:44:47 +00:00
Merge pull request #29 from gianarb/hotfix/avoid-scaling-down
avoiding scale under 1, scale up services at 0
This commit is contained in:
commit
80acddce1d
@ -96,7 +96,7 @@ func (p SwarmProvider) Scale(serviceId string, target int, direction bool) error
|
||||
|
||||
// This function validate if a request is acceptable or not.
|
||||
func (p *SwarmProvider) isAcceptable(tasks []swarm.Task, target int, direction bool) error {
|
||||
if p.calculateActiveTasks(tasks) < target && direction == false {
|
||||
if p.calculateActiveTasks(tasks) < target || p.calculateActiveTasks(tasks) < 2 && direction == false {
|
||||
return errors.New(fmt.Sprintf("I can not scale down because it has only %d running.", target))
|
||||
}
|
||||
return nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user