Navigation Menu

Skip to content

Commit

Permalink
Adding blocking queue and appending blocking messages to queue.
Browse files Browse the repository at this point in the history
  • Loading branch information
tian2992 committed Oct 26, 2015
1 parent 7749930 commit 4bcb55a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion knitlib_webserver.py
Expand Up @@ -22,6 +22,7 @@
import shutil
from six.moves import cStringIO
import re
import uuid
import os
from werkzeug.utils import secure_filename
from geventwebsocket import websocket
Expand Down Expand Up @@ -229,10 +230,15 @@ def emit_progress(percent, done, total):
logging.info("log info {0}, {1}, {2}".format(percent, done, total))


blocking_queue = []

def emit_blocking_message(msg, level):
"""Callback for emitting blocking message progress."""
msg_id = uuid.uuid4()
logging.info("Blocking Action: {}".format(msg))
msg_queue.append({"type": "message", "data": msg, "level": level})
msg_queue.append({"type": "message", "data": msg, "level": level, "msg_id": unicode(msg_id)})
blocking_queue.append(unicode(msg_id))
# TODO: block and locks.
time.sleep(10)
pass

Expand Down

0 comments on commit 4bcb55a

Please sign in to comment.