I made a simple offscreen renderer with cefpython.
I use cefpython.MessageLoop()
, and I have a separate thread to do something every seconds:
[... cefpython initialization ...]
startTime = time.time()
def main_loop():
print time.time() - startTime
threading.Timer(1, main_loop).start()
main_loop()
cefpython.MessageLoop()
This works fine, but it slows down after 30 seconds (then the loop updates every 10 seconds).
This is the output that I get:
[CEF Python] Initialize() called
[CEF Python] CefExecuteProcess(): exitCode = -1
[CEF Python] CefInitialize()
[...]
3.11049604416
4.11594009399
5.11900210381
[...]
27.2121961117
28.2259521484
29.2369601727
[... then it updates every 10 seconds ...]
40.1490521431
50.1502101421
60.1521630287
Strangely, the loop also updates when I switch focus from my terminal window to google chrome (but not when I switch from my terminal to other apps).
--- Update ---
The loop runs properly if I give focus on the python app (accessible from python's rocket icon on the OS X dock). I was confused because the loop does not updates properly when I give focus to the terminal with which I launched the python script.