Reputation: 928
I want my flask APP to pull updates from a local txt file every 200ms, is it possible to do that?
P.S. I've considered BackgroundScheduler() from apschedulerler, but the granularity of is 1s.
Upvotes: 0
Views: 781
Reputation: 2347
Whatever you put inside the function will be dealt for every 200ms.
import datetime, threading
def foo():
print datetime.datetime.now()
threading.Timer(0.2, foo).start()
foo()
Upvotes: 2
Reputation: 5901
Couldn't you just start a loop in a thread that sleeps for 200 ms before the next iteration?
Upvotes: 1