def testRaceToAcquire(self):
    lock_to_release = []

    def _OnAcquire(update_func, lock, status):
      lock_to_release.append(lock)
      update_func()

    def _Race(update_func):
      if len(lock_to_release) == 0:
        # Win race to acquire lock.
        Lock.TryAcquire(self._client, 'op', 'id', partial(_OnAcquire, update_func))
      elif len(lock_to_release) == 1:
        # Win race to update acquire_failures.
        Lock.TryAcquire(self._client, 'op', 'id', partial(_OnAcquire, update_func))
      else:
        update_func()

    self._TryAcquire('op', 'id', expected_status=Lock.FAILED_TO_ACQUIRE_LOCK,
                     test_hook=_Race)

    self._Release(lock_to_release[0])
Sync the torrents by supplied LAST RESPONSE ID.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/test/lock_test.py/LockTestCase.testRaceToAcquire--crossover with--dataset/ETHPy150Open v1k45/python-qBittorrent/qbittorrent/client.py/Client.sync