|
@@ -14,6 +14,7 @@ import os
|
|
|
import time
|
|
|
import socket
|
|
|
import threading
|
|
|
+import warnings
|
|
|
|
|
|
from collections import deque
|
|
|
from contextlib import contextmanager
|
|
@@ -36,6 +37,14 @@ event_exchange = Exchange('celeryev', type='topic')
|
|
|
|
|
|
_TZGETTER = itemgetter('utcoffset', 'timestamp')
|
|
|
|
|
|
+W_YAJL = """
|
|
|
+anyjson is currently using the yajl library.
|
|
|
+This json implementation is broken, it severely truncates floats
|
|
|
+so timestamps will not work.
|
|
|
+
|
|
|
+Please uninstall yajl or force anyjson to use a different library.
|
|
|
+"""
|
|
|
+
|
|
|
|
|
|
def get_exchange(conn):
|
|
|
ex = copy(event_exchange)
|
|
@@ -139,6 +148,12 @@ class EventDispatcher(object):
|
|
|
self.enable()
|
|
|
self.headers = {'hostname': self.hostname}
|
|
|
self.pid = os.getpid()
|
|
|
+ self.warn_if_yajl()
|
|
|
+
|
|
|
+ def warn_if_yajl(self):
|
|
|
+ import anyjson
|
|
|
+ if anyjson.implementation.name == 'yajl':
|
|
|
+ warnings.warn(UserWarning(W_YAJL))
|
|
|
|
|
|
def __enter__(self):
|
|
|
return self
|