Converted to Twisted from asyncore. Not positive if this is just my local machine, but it seems like this backend is a bit faster.
This commit is contained in:
parent
82f46a2b69
commit
97cf1213e6
8 changed files with 113 additions and 145 deletions
10
events.py
10
events.py
|
|
@ -1,17 +1,21 @@
|
|||
import time
|
||||
from twisted.internet import protocol, reactor, defer
|
||||
import session_mgr
|
||||
|
||||
"""
|
||||
Holds the events scheduled in scheduler.py.
|
||||
"""
|
||||
|
||||
# Dictionary of events with a list in the form of: [<interval>, <lastrantime>]
|
||||
schedule = {
|
||||
'check_sessions': 60,
|
||||
'check_sessions': [60, None]
|
||||
}
|
||||
|
||||
lastrun = {}
|
||||
|
||||
def check_sessions():
|
||||
"""
|
||||
Check all of the connected sessions.
|
||||
Event: Check all of the connected sessions.
|
||||
"""
|
||||
session_mgr.check_all_sessions()
|
||||
schedule['check_sessions'][1] = time.time()
|
||||
reactor.callLater(schedule['check_sessions'][0], check_sessions)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue