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