Exemple #1
0
            public BackupJob BackupGame(BackupSet set, bool forceAsynchronous = false)
            {
                Log.Info("adding backup job for " + set.name + " (" + backupQueue.Size() + " backups in queue)");
                allBackupsCompleted = false;
                BackupJob job = new BackupJob(set);

                if (SAVE.configuration.asynchronous || forceAsynchronous)
                {
                    Log.Info("adding backup job for " + set.name + " (" + backupQueue.Size() + " backups in queue)");
                    backupQueue.Enqueue(job);
                }
                else
                {
                    Log.Info("synchronous backup to backup set '" + set.name);
                    // wait for asynchronous backups to complete
                    while (backupQueue.Size() > 0)
                    {
                        Thread.Sleep(100);
                    }
                    // do backup
                    job.Backup();
                    // done
                    allBackupsCompleted = true;
                }
                return(job);
            }
Exemple #2
0
 public void BackupWork()
 {
     Log.Info("backup thread running");
     while (!stopRequested)
     {
         BackupJob job = backupQueue.Dequeue();
         Log.Info("executing backup job " + job);
         job.Backup();
         allBackupsCompleted = backupQueue.Size() == 0;
     }
     Log.Info("backup thread terminated");
 }