Space-Face commited on
Commit
90bfb6e
1 Parent(s): 3645afb

Update SpaceFace.py

Browse files
Files changed (1) hide show
  1. SpaceFace.py +12 -6
SpaceFace.py CHANGED
@@ -128,7 +128,13 @@ def thread(n):
128
  else:
129
  endpoint[reqendpoint].receivedMessage(payload, user, respond)
130
 
131
-
 
 
 
 
 
 
132
  def start_server(endpoints):
133
  global projectid
134
  global conn
@@ -137,8 +143,8 @@ def start_server(endpoints):
137
  endpoint = endpoints
138
  conn = session.connect_cloud(projectid)
139
  threads = [threading.Thread(target=thread, args=(i+1,)) for i in range(10)]
140
- while True:
141
- time.sleep(1)
142
- for k, v in users:
143
- if time.time() - v.last_request >= 300:
144
- del users[k]
 
128
  else:
129
  endpoint[reqendpoint].receivedMessage(payload, user, respond)
130
 
131
+ def monitor_users():
132
+ global users
133
+ while True:
134
+ time.sleep(1)
135
+ for k, v in users:
136
+ if time.time() - v.last_request >= 300:
137
+ del users[k]
138
  def start_server(endpoints):
139
  global projectid
140
  global conn
 
143
  endpoint = endpoints
144
  conn = session.connect_cloud(projectid)
145
  threads = [threading.Thread(target=thread, args=(i+1,)) for i in range(10)]
146
+ for t in threads:
147
+ t.start()
148
+ monitorusers = threading.Thread(target=monitor_users)
149
+ monitor_users.start()
150
+