server/sources/datafeed.py
branchstable
changeset 7933 b25dda2214a2
parent 7921 a93e2ed5877a
child 7934 2250a60a7653
--- a/server/sources/datafeed.py	Tue Oct 11 13:50:32 2011 +0200
+++ b/server/sources/datafeed.py	Tue Oct 11 13:54:17 2011 +0200
@@ -149,10 +149,10 @@
         # XXX race condition until WHERE of SET queries is executed using
         # 'SELECT FOR UPDATE'
         now = datetime.utcnow()
-        if not session.execute('SET X in_synchronizaton %(now)s WHERE X eid %(x)s, X synchronizing NULL OR X synchronizing < %(maxdt)s',
-                               {'x': self.eid,
-                                'now': now,
-                                'maxdt': now - self.max_lock_lifetime}):
+        if not session.execute(
+            'SET X in_synchronization %(now)s WHERE X eid %(x)s, '
+            'X in_synchronization NULL OR X in_synchronization < %(maxdt)s',
+            {'x': self.eid, 'now': now, 'maxdt': now - self.max_lock_lifetime}):
             self.error('concurrent synchronization detected, skip pull')
             session.commit(free_cnxset=False)
             return False
@@ -161,7 +161,7 @@
 
     def release_synchronization_lock(self, session):
         session.set_cnxset()
-        session.execute('SET X synchronizing None WHERE X eid %(x)s',
+        session.execute('SET X in_synchronization NULL WHERE X eid %(x)s',
                         {'x': self.eid})
         session.commit()