I’m trying to run a background function in Frappe at an interval of every 2 seconds.
I know that the built-in Frappe scheduler supports only minutely, hourly, daily, etc., through hooks.py. But in my use case, I need a function that runs more frequently (every 2 seconds).
I have tried using a while True loop with time.sleep(2), but the issue is that:
- There’s no clean way to stop the loop once it starts.
- If I make code changes, the old loop keeps running and doesn’t pick up the new code without restarting manually.