Skip to content

Instantly share code, notes, and snippets.

@dvinella
Created March 24, 2015 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvinella/31d94f9dd0e47586658d to your computer and use it in GitHub Desktop.
Save dvinella/31d94f9dd0e47586658d to your computer and use it in GitHub Desktop.
import time
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from twisted.python import log
from twisted.python.logfile import LogFile
log.startLogging(LogFile('lc.log', '.'))
def count_callable(calls):
log.msg(format='***************** %(t)f calls:%(c)d',
t=time.time(), c=calls)
if calls != 1:
log.msg('******************************************* anomaly')
def debug_lc(lc):
log.msg(format="_expectNextCallAt %(x)f", x=lc._expectNextCallAt)
log.msg(format=" _realLastTime %(x)f", x=lc._realLastTime)
lc = LoopingCall.withCount(count_callable)
lc.start(0.02)
lc_debug = LoopingCall(debug_lc, lc)
lc_debug.start(0.02)
reactor.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment