コード例 #1
0
ファイル: base.py プロジェクト: cedricmoullet/mapproxy
 def lock(self, tile):
     """
     Returns a lock object for this tile.
     """
     lock_filename = self.lock_filename(tile)
     cleanup_lockdir(self.lock_dir, force=False)
     return FileLock(lock_filename, timeout=self.lock_timeout,
         remove_on_unlock=True)
コード例 #2
0
ファイル: base.py プロジェクト: ChrisRenton/mapproxy
 def lock(self, tile):
     """
     Returns a lock object for this tile.
     """
     if getattr(self, 'locking_disabled', False):
         return DummyLock()
     lock_filename = self.lock_filename(tile)
     cleanup_lockdir(self.lock_dir, force=False)
     return FileLock(lock_filename, timeout=self.lock_timeout,
         remove_on_unlock=True)
コード例 #3
0
ファイル: base.py プロジェクト: imclab/mapproxy
 def lock(self, tile):
     """
     Returns a lock object for this tile.
     """
     if getattr(self, 'locking_disabled', False):
         return DummyLock()
     lock_filename = self.lock_filename(tile)
     cleanup_lockdir(self.lock_dir, force=False)
     return FileLock(lock_filename, timeout=self.lock_timeout,
         remove_on_unlock=True)
コード例 #4
0
ファイル: base.py プロジェクト: keithamoss/mapproxy
 def lock(self, tile):
     """
     Returns a lock object for this tile.
     """
     if getattr(self, 'locking_disabled', False):
         return DummyLock()
     lock_filename = self.lock_filename(tile)
     try:
         cleanup_lockdir(self.lock_dir, force=False)
     except WindowsError, ex:
         log.warn("WindowsError: %s", ex)
コード例 #5
0
ファイル: test_utils.py プロジェクト: GeoDodo/mapproxy
    def test_lock_cleanup(self):
        old_lock_file = os.path.join(self.lock_dir, 'lock_old.lck')
        l = FileLock(old_lock_file)
        l.lock()
        l.unlock()
        mtime = os.stat(old_lock_file).st_mtime
        mtime -= 7*60
        os.utime(old_lock_file, (mtime, mtime))

        l = self._create_lock()
        l.unlock()
        assert os.path.exists(old_lock_file)
        assert os.path.exists(self.lock_file)
        cleanup_lockdir(self.lock_dir)

        assert not os.path.exists(old_lock_file)
        assert os.path.exists(self.lock_file)
コード例 #6
0
    def test_lock_cleanup(self):
        old_lock_file = os.path.join(self.lock_dir, 'lock_old.lck')
        l = FileLock(old_lock_file)
        l.lock()
        l.unlock()
        mtime = os.stat(old_lock_file).st_mtime
        mtime -= 7 * 60
        os.utime(old_lock_file, (mtime, mtime))

        l = self._create_lock()
        l.unlock()
        assert os.path.exists(old_lock_file)
        assert os.path.exists(self.lock_file)
        cleanup_lockdir(self.lock_dir)

        assert not os.path.exists(old_lock_file)
        assert os.path.exists(self.lock_file)