server/sources/datafeed.py
changeset 7461 cb25b62074cc
parent 7456 c54038622fc9
child 7527 ef1e9bc38137
equal deleted inserted replaced
7460:2455cdbeadca 7461:cb25b62074cc
   135 
   135 
   136     def acquire_synchronization_lock(self, session):
   136     def acquire_synchronization_lock(self, session):
   137         # XXX race condition until WHERE of SET queries is executed using
   137         # XXX race condition until WHERE of SET queries is executed using
   138         # 'SELECT FOR UPDATE'
   138         # 'SELECT FOR UPDATE'
   139         if not session.execute('SET X synchronizing TRUE WHERE X eid %(x)s, X synchronizing FALSE',
   139         if not session.execute('SET X synchronizing TRUE WHERE X eid %(x)s, X synchronizing FALSE',
   140                                {'x': self.eid})[0][0]:
   140                                {'x': self.eid}):
   141             self.error('concurrent synchronization detected, skip pull')
   141             self.error('concurrent synchronization detected, skip pull')
   142             session.commit(free_cnxset=False)
   142             session.commit(free_cnxset=False)
   143             return False
   143             return False
   144         session.commit(free_cnxset=False)
   144         session.commit(free_cnxset=False)
   145         return True
   145         return True