summaryrefslogtreecommitdiff
path: root/app/models/backup_job.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-04 12:04:00 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-04 12:04:00 +0100
commit5b0c099cebaad0465380458d09aeeec904ae6691 (patch)
treeeb2f0cc4bf94792bcca5bec69746e60f194f25e7 /app/models/backup_job.rb
parent46e3a768b175a80ae54e6b97b8cf6c4146718134 (diff)
rake db:force_now (does a backup without queuing).
Diffstat (limited to 'app/models/backup_job.rb')
-rw-r--r--app/models/backup_job.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb
index a04f6c0..48dd27e 100644
--- a/app/models/backup_job.rb
+++ b/app/models/backup_job.rb
@@ -12,12 +12,17 @@ class BackupJob < ActiveRecord::Base
private
def set_state_to_queued
- self.state = 'queued'
+ self.state ||= 'queued'
self.started_at = Time.now
end
def initiate_backup
- self.delay.make_a_backup
+ if self.state == 'force now'
+ self.state = 'queued'
+ self.make_a_backup
+ else
+ self.delay.make_a_backup
+ end
end
def make_a_backup