Skip to content

Commit

Permalink
Extend timeout more
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 1, 2023
1 parent 5733963 commit cd1cf2d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ env:
PY_COLORS
PYTEST_THEME
PYTEST_THEME_MODE
GITHUB_*
RUNNER_*
# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
Expand Down
14 changes: 13 additions & 1 deletion jaraco/mongodb/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ def merge_mongod_args(self, add_args):
self.port, add_args[:] = cli.extract_param('port', add_args, type=int)
self.mongod_args = add_args

@property
def _startup_timeout(self):
"""
On GitHub Actions on Windows, MongoDB takes forever to
start, but starts up fast locally and on other platforms.
"""
slow = (
os.environ.get('GITHUB_ACTIONS')
and os.environ.get('RUNNER_OS') == 'Windows'
)
return 120 if slow else 10

def start(self):
super(MongoDBInstance, self).start()
if not hasattr(self, 'port') or not self.port:
Expand All @@ -119,7 +131,7 @@ def start(self):
if hasattr(self, 'bind_ip') and '--bind_ip' not in cmd:
cmd.extend(['--bind_ip', self.bind_ip])
self.process = subprocess.Popen(cmd, **self.process_kwargs)
portend.occupied('localhost', self.port, timeout=10)
portend.occupied('localhost', self.port, timeout=self._startup_timeout)
log.info(f'{self} listening on {self.port}')

def get_connection(self):
Expand Down

0 comments on commit cd1cf2d

Please # to comment.