server/sources/datafeed.py
changeset 7934 2250a60a7653
parent 7931 60068dc83457
parent 7933 b25dda2214a2
child 7950 99ae8c883ad3
--- a/server/sources/datafeed.py	Tue Oct 11 11:00:24 2011 +0200
+++ b/server/sources/datafeed.py	Tue Oct 11 13:55:58 2011 +0200
@@ -151,10 +151,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
@@ -163,7 +163,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()