diff --git a/server/config.py b/server/config.py index 98082dfdc..7bffff5a7 100644 --- a/server/config.py +++ b/server/config.py @@ -148,6 +148,8 @@ def __init__(self): self.MAP_POOL_RATING_SELECTION = "mean" # The maximum amount of time in seconds to wait between pops self.QUEUE_POP_TIME_MAX = 90 + # The minimum amount of time in seconds to wait between pops + self.QUEUE_POP_TIME_MIN = 15 # The number of possible matches we would like to have when the queue # pops. The queue pop time will be adjusted based on the current rate of # players queuing to try and hit this number. diff --git a/server/matchmaker/pop_timer.py b/server/matchmaker/pop_timer.py index 5425707f9..e5894ca91 100644 --- a/server/matchmaker/pop_timer.py +++ b/server/matchmaker/pop_timer.py @@ -84,6 +84,14 @@ def time_until_next_pop(self, num_queued: int, time_queued: float) -> float: next_pop_time, self.queue.name, config.QUEUE_POP_TIME_MAX ) return config.QUEUE_POP_TIME_MAX + + if next_pop_time < config.QUEUE_POP_TIME_MIN: + self._logger.warning( + "Required time (%.2fs) for %s is lower than min pop time (%ds). ", + next_pop_time, self.queue.name, config.QUEUE_POP_TIME_MIN + ) + return config.QUEUE_POP_TIME_MIN + return next_pop_time def cancel(self): diff --git a/tests/unit_tests/test_pop_timer.py b/tests/unit_tests/test_pop_timer.py index 44c05a974..350a411db 100644 --- a/tests/unit_tests/test_pop_timer.py +++ b/tests/unit_tests/test_pop_timer.py @@ -36,7 +36,7 @@ def test_queue_pop_time_moving_average_size(queue_factory): t1.time_until_next_pop(100, 1) # The rate should be extremely high, meaning the pop time should be low - assert t1.time_until_next_pop(100, 1) < 1 + assert t1.time_until_next_pop(100, 1) == config.QUEUE_POP_TIME_MIN for _ in range(config.QUEUE_POP_TIME_MOVING_AVG_SIZE): t1.time_until_next_pop(0, 100)