Skip to content

Commit ce4dfcf

Browse files
vdusekclaude
andcommitted
Simplify TimeoutError handler: just log, don't attempt forced cleanup
Removed the forced __aexit__ calls on event_manager and charging_manager after timeout - if finalize() timed out, those calls would likely hang too. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 57b0fd1 commit ce4dfcf

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/apify/_actor.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,7 @@ async def finalize() -> None:
255255
try:
256256
await asyncio.wait_for(finalize(), self._cleanup_timeout.total_seconds())
257257
except TimeoutError:
258-
self.log.warning('Actor cleanup timed out, forcing shutdown of event manager and charging manager')
259-
# Ensure critical resources are cleaned up even after timeout
260-
with suppress(Exception):
261-
await self.event_manager.__aexit__(None, None, None)
262-
with suppress(Exception):
263-
await self._charging_manager_implementation.__aexit__(None, None, None)
258+
self.log.exception('Actor cleanup timed out')
264259
finally:
265260
self._is_initialized = False
266261

0 commit comments

Comments
 (0)