MCPcopy Create free account
hub / github.com/apify/crawlee-python / _wrapper

Method _wrapper

src/crawlee/_utils/recurring_task.py:49–58  ·  view source on GitHub ↗

Continuously execute the provided function with the specified delay. Run the function in a loop, waiting for the configured delay between executions. Supports both synchronous and asynchronous functions.

(self)

Source from the content-addressed store, hash-verified

47 await self.stop()
48
49 async def _wrapper(self) -> None:
50 """Continuously execute the provided function with the specified delay.
51
52 Run the function in a loop, waiting for the configured delay between executions.
53 Supports both synchronous and asynchronous functions.
54 """
55 sleep_time_secs = self.delay.total_seconds()
56 while True:
57 await self.func() if inspect.iscoroutinefunction(self.func) else self.func()
58 await asyncio.sleep(sleep_time_secs)
59
60 def start(self) -> None:
61 """Start the recurring task execution."""

Callers 1

startMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected