Ejemplo n.º 1
0
func unlockRepo(lock *restic.Lock) error {
	if err := lock.Unlock(); err != nil {
		return err
	}

	for i := 0; i < len(globalLocks); i++ {
		if lock == globalLocks[i] {
			globalLocks = append(globalLocks[:i], globalLocks[i+1:]...)
			return nil
		}
	}

	return nil
}
Ejemplo n.º 2
0
func unlockRepo(lock *restic.Lock) error {
	globalLocks.Lock()
	defer globalLocks.Unlock()

	debug.Log("unlockRepo", "unlocking repository")
	if err := lock.Unlock(); err != nil {
		debug.Log("unlockRepo", "error while unlocking: %v", err)
		return err
	}

	for i := 0; i < len(globalLocks.locks); i++ {
		if lock == globalLocks.locks[i] {
			globalLocks.locks = append(globalLocks.locks[:i], globalLocks.locks[i+1:]...)
			return nil
		}
	}

	return nil
}