editstore 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,7 +160,8 @@ In production, you can also use this task to clean out any rows that have been m
160
160
 
161
161
  Use this task to clear out the unlocked druids from the object lock table. Should be safe to run at any time.
162
162
 
163
- rake editstore:prune_locks
163
+ rake editstore:prune_locks # prune any unlocked druids older than 1 month
164
+ rake editstore:prune_locks_all # prune all unlocked druids
164
165
 
165
166
  Use this task to clear out the locked druids from the object lock table. Should only be run if you are sure locks have hung and
166
167
  there are no other processes running.
@@ -169,7 +170,9 @@ there are no other processes running.
169
170
 
170
171
  Use this task to clear out the any log run entries older than one month. Should be safe to run at any time if you don't need more than 1 month of run log history
171
172
 
172
- rake editstore:prune_run_log
173
+ rake editstore:prune_run_log # prune any run logs older than 1 month and any run logs older than 24 hours with no activity
174
+ rake editstore:prune_run_log_all # prune any run logs that are not in process
175
+
173
176
 
174
177
  == Running Tests
175
178
 
@@ -2,12 +2,16 @@ module Editstore
2
2
  class ObjectLock < Connection
3
3
  attr_accessible :locked, :druid
4
4
 
5
- def self.prune
6
- self.destroy_all(:locked=>nil)
5
+ def self.prune_all
6
+ self.destroy_all(:locked=>nil) # anything that is not locked
7
7
  end
8
8
 
9
+ def self.prune
10
+ self.where(:locked=>nil).where('updated_at < ?',1.month.ago).each {|obj| obj.destroy} # anything that is not locked older than 1 month
11
+ end
12
+
9
13
  def self.unlock_all
10
- self.all_locked.each {|obj| obj.unlock}
14
+ self.all_locked.each {|obj| obj.unlock} # unlock anything that is locked
11
15
  end
12
16
 
13
17
  def self.get_pid(pid)
@@ -1,8 +1,18 @@
1
1
  module Editstore
2
2
  class RunLog < Connection
3
- attr_accessible :total_druids,:total_changes,:num_errors,:num_pending,:note
3
+ attr_accessible :started,:ended,:total_druids,:total_changes,:num_errors,:num_pending,:note
4
+ def self.currently_running
5
+ Editstore::RunLog.where(:ended=>nil).order('ended DESC')
6
+ end
7
+ def self.last_completed_run
8
+ Editstore::RunLog.where('ended IS NOT NULL').order('ended DESC').limit(1).first
9
+ end
4
10
  def self.prune
5
- self.where('updated_at < ?',1.month.ago).each {|obj| obj.destroy}
11
+ self.where('updated_at < ?',1.month.ago).each {|obj| obj.destroy} # anything older than 1 month
12
+ self.where(:total_druids=>0).where('updated_at < ?',1.day.ago).each {|obj| obj.destroy} # anything older than 1 day with no activity
13
+ end
14
+ def self.prune_all
15
+ self.where('ended IS NOT NULL').each {|obj| obj.destroy} # anything that is done
6
16
  end
7
17
  end
8
18
  end
@@ -1,3 +1,3 @@
1
1
  module Editstore
2
- VERSION = "1.1.5"
2
+ VERSION = "1.1.6"
3
3
  end
@@ -5,16 +5,26 @@ namespace :editstore do
5
5
  Editstore::Change.prune
6
6
  end
7
7
 
8
- desc "Prune run log to remove entries over 1 month old"
8
+ desc "Prune run log to remove entries over 1 month old and entries with no activity over 1 day old"
9
9
  task :prune_run_log => :environment do
10
10
  Editstore::RunLog.prune
11
11
  end
12
+
13
+ desc "Prune run log to remove all completed entries"
14
+ task :prune_run_log_all => :environment do
15
+ Editstore::RunLog.prune_all
16
+ end
12
17
 
13
- desc "Prune locked object tables to remove any unlocked druids"
18
+ desc "Prune locked object tables to remove any unlocked druids older than 1 month"
14
19
  task :prune_locks => :environment do
15
20
  Editstore::ObjectLock.prune
16
21
  end
17
22
 
23
+ desc "Prune locked object tables to remove all unlocked druids"
24
+ task :prune_locks_all => :environment do
25
+ Editstore::ObjectLock.prune_all
26
+ end
27
+
18
28
  desc "Remove all object locks for any druids"
19
29
  task :clear_locks => :environment do
20
30
  Editstore::ObjectLock.unlock_all
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-17 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  segments:
186
186
  - 0
187
- hash: 4522800769409732582
187
+ hash: 2556779975228874083
188
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  none: false
190
190
  requirements:
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  segments:
195
195
  - 0
196
- hash: 4522800769409732582
196
+ hash: 2556779975228874083
197
197
  requirements: []
198
198
  rubyforge_project:
199
199
  rubygems_version: 1.8.24