private bool IsSynchronizationInProgress(string originalFileName) { if (!fileLockManager.TimeoutExceeded(originalFileName, storage)) { return(true); } return(false); }
public void AssertFileIsNotBeingSynced(string fileName) { Storage.Batch(accessor => { if (FileLockManager.TimeoutExceeded(fileName, accessor)) { FileLockManager.UnlockByDeletingSyncConfiguration(fileName, accessor); } else { Log.Debug("Cannot execute operation because file '{0}' is being synced", fileName); throw new SynchronizationException(string.Format("File {0} is being synced", fileName)); } }); }
protected void AssertFileIsNotBeingSynced(string fileName, IStorageActionsAccessor accessor, bool wrapByResponseException = false) { if (FileLockManager.TimeoutExceeded(fileName, accessor)) { FileLockManager.UnlockByDeletingSyncConfiguration(fileName, accessor); } else { Log.Debug("Cannot execute operation because file '{0}' is being synced", fileName); var beingSyncedException = new SynchronizationException(string.Format("File {0} is being synced", fileName)); if (wrapByResponseException) { throw new HttpResponseException(Request.CreateResponse((HttpStatusCode)420, beingSyncedException)); } throw beingSyncedException; } }