mirror of
https://github.com/spaytac/orbiter.git
synced 2026-01-21 23:34:41 +00:00
avoiding scale under 1, scale up services at 0
This commit is contained in:
parent
29cfd3d109
commit
861fc14781
@ -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.
|
// This function validate if a request is acceptable or not.
|
||||||
func (p *SwarmProvider) isAcceptable(tasks []swarm.Task, target int, direction bool) error {
|
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 errors.New(fmt.Sprintf("I can not scale down because it has only %d running.", target))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user