[Mod]统一使用queue
This commit is contained in:
parent
d7ee0c3448
commit
325717a9c6
@ -10,7 +10,7 @@ import hmac
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import time, sleep , mktime
|
from time import time, sleep , mktime
|
||||||
from Queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import urllib
|
import urllib
|
||||||
import websocket
|
import websocket
|
||||||
|
@ -11,7 +11,7 @@ import hmac
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import time, sleep , mktime
|
from time import time, sleep , mktime
|
||||||
from Queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import urllib
|
import urllib
|
||||||
import websocket
|
import websocket
|
||||||
|
@ -10,7 +10,7 @@ import hmac
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import time, sleep , mktime
|
from time import time, sleep , mktime
|
||||||
from Queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import json
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from threading import Condition
|
from threading import Condition
|
||||||
from Queue import Queue
|
from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
@ -9,7 +9,7 @@ import json
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from threading import Condition
|
from threading import Condition
|
||||||
from Queue import Queue
|
from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
@ -10,7 +10,7 @@ from datetime import datetime
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from threading import Condition
|
from threading import Condition
|
||||||
from Queue import Queue
|
from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import zmq
|
import zmq
|
||||||
import Queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import msgpack
|
import msgpack
|
||||||
import snappy
|
import snappy
|
||||||
@ -37,7 +37,7 @@ class JRpcServer :
|
|||||||
self._should_close = False
|
self._should_close = False
|
||||||
self._send_lock = threading.Lock()
|
self._send_lock = threading.Lock()
|
||||||
|
|
||||||
self._callback_queue = Queue.Queue()
|
self._callback_queue = queue.Queue()
|
||||||
|
|
||||||
self._ctx = zmq.Context()
|
self._ctx = zmq.Context()
|
||||||
self._pull_sock = self._ctx.socket(zmq.PULL)
|
self._pull_sock = self._ctx.socket(zmq.PULL)
|
||||||
@ -121,7 +121,7 @@ class JRpcServer :
|
|||||||
r = self._callback_queue.get(timeout = 1)
|
r = self._callback_queue.get(timeout = 1)
|
||||||
if r :
|
if r :
|
||||||
r()
|
r()
|
||||||
except Queue.Empty as e:
|
except queue.Empty as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -9,10 +9,7 @@ import zmq
|
|||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
try:
|
import queue
|
||||||
import queue
|
|
||||||
except ImportError:
|
|
||||||
import queue as queue
|
|
||||||
import threading
|
import threading
|
||||||
import msgpack
|
import msgpack
|
||||||
import snappy
|
import snappy
|
||||||
|
@ -10,10 +10,7 @@ from builtins import *
|
|||||||
|
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
try:
|
import queue
|
||||||
import queue
|
|
||||||
except ImportError:
|
|
||||||
import queue as queue
|
|
||||||
import threading
|
import threading
|
||||||
import msgpack
|
import msgpack
|
||||||
import snappy
|
import snappy
|
||||||
|
@ -8,7 +8,7 @@ import json
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from Queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from multiprocessing.dummy import Pool
|
from multiprocessing.dummy import Pool
|
||||||
from time import time
|
from time import time
|
||||||
|
@ -13,7 +13,7 @@ import copy
|
|||||||
import traceback
|
import traceback
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import datetime, timedelta, time
|
from datetime import datetime, timedelta, time
|
||||||
from Queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from pymongo.errors import DuplicateKeyError
|
from pymongo.errors import DuplicateKeyError
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user