예제 #1
0
 private bool IsSynchronizationInProgress(string originalFileName)
 {
     if (!fileLockManager.TimeoutExceeded(originalFileName, storage))
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
        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));
                }
            });
        }
예제 #3
0
        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;
            }
        }