Skip to content

Commit

Permalink
fix(components/core/DownloadDaemon.py):
Browse files Browse the repository at this point in the history
appended handler to list
added log for socket close
  • Loading branch information
hv7214 committed Feb 2, 2020
1 parent 75fc9cb commit 732cf42
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions components/core/DownloadDaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __init__(self, ws):
queue.Queue.__init__(self)
self.ws = ws
self.num_workers = 5
self.start_workers()

def add_to_queue(self, download):
self.put(download)
Expand Down Expand Up @@ -67,7 +66,7 @@ def worker(self):

class MessageHandler():

def __init__(self,ws):
def __init__(self, ws):
self.num_workers = 5
self.ws = ws

Expand Down Expand Up @@ -135,7 +134,7 @@ def worker(self):
get_status(self.ws, None, data['params'][0]['gid'])
db_lock.release()
messageQueue.task_done()

class RepeatedTimer(object):
def __init__(self, interval, function, *args, **kwargs):
self._timer = None
Expand Down Expand Up @@ -240,8 +239,7 @@ def on_error(ws, error):


def on_close(ws):
pass

logging.info("Socket closed")

def on_open(ws):
initialize(ws)
Expand All @@ -259,13 +257,13 @@ def starter(socket):
on_close=on_close)
ws.on_open = on_open
handler = Handler(ws)
handlerLst.append(handler)
# socketio.emit("test", {'data': 'A NEW FILE WAS POSTED'}, namespace='/news')
threading.Thread(target=handler.start_workers).start()
mHandler = MessageHandler(ws)
mHandler = MessageHandler(ws)
threading.Thread(target=mHandler.start_message_workers).start()
messageQueue.join()
ws.run_forever()




0 comments on commit 732cf42

Please sign in to comment.