summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 15:37:53 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 15:37:53 +0100
commit7a2de6e118b1b88a34efa87cbd27f398a690c717 (patch)
treea561e044ae6333dffed340dcc32af9bc2f66a0a0
parent02a5f7f9eb5e62a0e1498e151c6e9dd968aec6fd (diff)
downloadpykolab-7a2de6e118b1b88a34efa87cbd27f398a690c717.tar.gz
Loop through the thread's synchronization routine continuously
-rw-r--r--kolabd/process.py19
-rw-r--r--tests/functional/test_kolabd/test_001_user_sync.py8
2 files changed, 18 insertions, 9 deletions
diff --git a/kolabd/process.py b/kolabd/process.py
index c936fdc..f5f5352 100644
--- a/kolabd/process.py
+++ b/kolabd/process.py
@@ -17,6 +17,7 @@
#
import multiprocessing
+import os
import time
import pykolab
@@ -37,12 +38,12 @@ class KolabdProcess(multiprocessing.Process):
)
def synchronize(self, domain):
- try:
- auth = Auth(domain)
- auth.connect(domain)
- auth.synchronize()
- except Exception, errmsg:
- log.error(_("Error in process %r, terminating:\n\t%r") % (self.name, errmsg))
- import traceback
- traceback.print_exc()
- return
+ while True:
+ try:
+ auth = Auth(domain)
+ auth.connect(domain)
+ auth.synchronize()
+ except Exception, errmsg:
+ log.error(_("Error in process %r, terminating:\n\t%r") % (self.name, errmsg))
+ import traceback
+ traceback.print_exc()
diff --git a/tests/functional/test_kolabd/test_001_user_sync.py b/tests/functional/test_kolabd/test_001_user_sync.py
index 44858bb..aef47aa 100644
--- a/tests/functional/test_kolabd/test_001_user_sync.py
+++ b/tests/functional/test_kolabd/test_001_user_sync.py
@@ -48,6 +48,8 @@ class TestKolabDaemon(unittest.TestCase):
}
user_add("Jane", "Doe")
+ time.sleep(3)
+
auth = Auth()
auth.connect()
recipient = auth.find_recipient("%(local)s@%(domain)s" % (user))
@@ -58,6 +60,12 @@ class TestKolabDaemon(unittest.TestCase):
result = wap_client.user_info(recipient)
+ if not result.has_key('mailhost'):
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+
+ result = wap_client.user_info(recipient)
+
self.assertEqual(result['mail'], 'jane.doe@example.org')
self.assertEqual(result['alias'], ['doe2@example.org', 'j.doe2@example.org'])