Reliability improvements

This commit is contained in:
Adrián Chaves 2025-03-26 23:28:29 +01:00
parent 7668a693e8
commit 49b839b270
2 changed files with 4 additions and 5 deletions

View File

@ -198,6 +198,8 @@ class ExecutionEngine:
exc_info=True,
)
else:
if not self.spider:
return # spider already closed
if isinstance(item_or_request, Request):
self.crawl(item_or_request)
else:
@ -219,7 +221,7 @@ class ExecutionEngine:
self._slot.nextcall.schedule()
self._slot.heartbeat.start(self._SLOT_HEARTBEAT_INTERVAL)
while self._start is not None:
while self._start and self.spider:
await self._process_start_next()
if not self.needs_backout():
# Give room for the outcome of self._process_start_next() to be

View File

@ -109,9 +109,6 @@ class RequestSendOrderTestCase(TestCase):
that can be sent before the first callback requests are scheduled.
"""
# Error out if any tests relies on the heartbeat.
timeout = ExecutionEngine._SLOT_HEARTBEAT_INTERVAL
@classmethod
def setUpClass(cls):
cls.mockserver = MockServer()
@ -122,7 +119,7 @@ class RequestSendOrderTestCase(TestCase):
cls.mockserver.__exit__(None, None, None)
fast_seconds = 0.001
slow_seconds = 1 # increase if flaky
slow_seconds = 2 # increase if flaky
def _request(self, num, response_seconds, download_slots):
url = self.mockserver.url(f"/delay?n={response_seconds}&{num}")