[FIX] runbot: limit port search to local host.

With the increasing number of runbot servers (17), the total number of docker
instances can reach more than 3570 only for running build. Starting at 2000,
this covers the posrt 5432 used by postgress and make the build run step fail.

This commit simply limit the port unicity constraint by host.
This commit is contained in:
Xavier-Do 2019-08-30 10:37:50 +02:00
parent 5297ac0f5f
commit 2e44c51678

View File

@ -511,7 +511,7 @@ class runbot_build(models.Model):
def _find_port(self):
# currently used port
ids = self.search([('local_state', 'not in', ['pending', 'done'])])
ids = self.search([('local_state', 'not in', ['pending', 'done']), ('host', '=', fqdn())])
ports = set(i['port'] for i in ids.read(['port']))
# starting port