Browse Source

Merge branch '3.0'

Conflicts:
	celery/utils/threads.py
Ask Solem 12 years ago
parent
commit
8b3b609a06

+ 2 - 1
CONTRIBUTORS.txt

@@ -117,4 +117,5 @@ Hynek Schlawack, 2012/07/23
 Paul McMillan, 2012/07/26
 Mitar, 2012/07/28
 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,
     DependencyGraph,
 )
+from celery.utils.threads import TIMEOUT_MAX
 from celery.tests.utils import Case, WhateverIO
 
 
@@ -221,7 +222,7 @@ class test_LRUCache(Case):
             def stop(self):
                 self._is_shutdown.set()
                 self._is_stopped.wait()
-                self.join(1e10)
+                self.join(TIMEOUT_MAX)
 
         burglar = Burglar(x)
         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')
 
 
+try:
+    TIMEOUT_MAX = threading.TIMEOUT_MAX
+except AttributeError:
+    TIMEOUT_MAX = 1e10  # noqa
+
+
 class bgThread(threading.Thread):
 
     def __init__(self, name=None, **kwargs):
@@ -70,7 +76,7 @@ class bgThread(threading.Thread):
         self._is_shutdown.set()
         self._is_stopped.wait()
         if self.is_alive():
-            self.join(1e100)
+            self.join(TIMEOUT_MAX)
 
 try:
     from greenlet import getcurrent as get_ident

+ 3 - 2
celery/utils/timer2.py

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