Open phantasia15 opened 3 years ago
thanks, could you please add a unit test that re-creates the state required to reproduce, and that fails without this fix, but passes with the fix? If you look at the unit tests for this file we attempt to test all known states, so this state should definitely be included. Thanks!
Hi, I've included the failed tests.
Hi, I'm currently using this configuration:
DRONE_AGENT_CONCURRENCY=1
,DRONE_CAPACITY_BUFFER=1
. When there is only 1 server, 1 running build, I expect the autoscaler to scale the num of servers to2
but the log say that no capacity changes required.I took a look the source code and found this: https://github.com/drone/autoscaler/blob/290741f7c495d0cb0ca029e8ff0863586df99c43/engine/planner.go#L78 In the above case:
I think the problem is that
buffer
is included infree
calculation, butfree
is forced to be at least 0, instead of -1 in this case. So I move the buffer intodiff
calcuation, treating it as apending
build:diff = serverDiff(pending+p.buffer, free, p.cap))
. This fixes the above issue while still keeps the logic thatfree
must be at least 0.