Ver código fonte

Merge branch '3.0'

Conflicts:
	celery/utils/threads.py
Ask Solem 12 anos atrás
pai
commit
8b3b609a06

+ 2 - 1
CONTRIBUTORS.txt

@@ -117,4 +117,5 @@ Hynek Schlawack, 2012/07/23
 Paul McMillan, 2012/07/26
 Paul McMillan, 2012/07/26
 Mitar, 2012/07/28
 Mitar, 2012/07/28
 Adam DePue, 2012/08/22
 Adam DePue, 2012/08/22
-Thomas Meson, 2012/08/28
+Thomas Meson, 2012/08/28
+Daniel Lundin, 2012/08/30 

+ 2 - 1
celery/tests/utilities/test_datastructures.py

@@ -9,6 +9,7 @@ from celery.datastructures import (
     ConfigurationView,
     ConfigurationView,
     DependencyGraph,
     DependencyGraph,
 )
 )
+from celery.utils.threads import TIMEOUT_MAX
 from celery.tests.utils import Case, WhateverIO
 from celery.tests.utils import Case, WhateverIO
 
 
 
 
@@ -221,7 +222,7 @@ class test_LRUCache(Case):
             def stop(self):
             def stop(self):
                 self._is_shutdown.set()
                 self._is_shutdown.set()
                 self._is_stopped.wait()
                 self._is_stopped.wait()
-                self.join(1e10)
+                self.join(TIMEOUT_MAX)
 
 
         burglar = Burglar(x)
         burglar = Burglar(x)
         burglar.start()
         burglar.start()

+ 7 - 1
celery/utils/threads.py

@@ -20,6 +20,12 @@ from celery.local import Proxy
 USE_PURE_LOCALS = os.environ.get('USE_PURE_LOCALS')
 USE_PURE_LOCALS = os.environ.get('USE_PURE_LOCALS')
 
 
 
 
+try:
+    TIMEOUT_MAX = threading.TIMEOUT_MAX
+except AttributeError:
+    TIMEOUT_MAX = 1e10  # noqa
+
+
 class bgThread(threading.Thread):
 class bgThread(threading.Thread):
 
 
     def __init__(self, name=None, **kwargs):
     def __init__(self, name=None, **kwargs):
@@ -70,7 +76,7 @@ class bgThread(threading.Thread):
         self._is_shutdown.set()
         self._is_shutdown.set()
         self._is_stopped.wait()
         self._is_stopped.wait()
         if self.is_alive():
         if self.is_alive():
-            self.join(1e100)
+            self.join(TIMEOUT_MAX)
 
 
 try:
 try:
     from greenlet import getcurrent as get_ident
     from greenlet import getcurrent as get_ident

+ 3 - 2
celery/utils/timer2.py

@@ -14,11 +14,12 @@ import os
 import sys
 import sys
 import threading
 import threading
 
 
+from datetime import datetime, timedelta
 from functools import wraps
 from functools import wraps
 from itertools import count, imap
 from itertools import count, imap
 from time import time, sleep, mktime
 from time import time, sleep, mktime
 
 
-from datetime import datetime, timedelta
+from celery.utils.threads import TIMEOUT_MAX
 from kombu.log import get_logger
 from kombu.log import get_logger
 
 
 VERSION = (1, 0, 0)
 VERSION = (1, 0, 0)
@@ -273,7 +274,7 @@ class Timer(threading.Thread):
         if self.running:
         if self.running:
             self._is_shutdown.set()
             self._is_shutdown.set()
             self._is_stopped.wait()
             self._is_stopped.wait()
-            self.join(1e10)
+            self.join(TIMEOUT_MAX)
             self.running = False
             self.running = False
 
 
     def ensure_started(self):
     def ensure_started(self):