resque-mongo-groups 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/resque_groups.rb CHANGED
@@ -25,12 +25,13 @@ module Resque::Plugins::Groups
25
25
  job_groups.update( {'_id' => gid},
26
26
  {
27
27
  '$inc' => {'total' => 1},
28
- '$set' => {'started_at' => Time.now}
28
+ '$set' => {'started_at' => Time.now, 'updated_at' => Time.now}
29
29
  }, {:upsert => true})
30
30
  else
31
31
  job_groups.update( {'_id' => gid},
32
32
  {
33
- '$inc' => {'total' => 1}
33
+ '$inc' => {'total' => 1},
34
+ '$set' => {'updated_at' => Time.now}
34
35
  }, {:upsert => true})
35
36
  end
36
37
  #Resque.print_groups
@@ -41,9 +42,10 @@ module Resque::Plugins::Groups
41
42
  # Also merge the increment operation with optional custom
42
43
  # atomic operations.
43
44
  def record_performed_job(gid, atomic_op = nil)
44
- op = {'$inc' => {'completed' => 1}}
45
+ op = {'$inc' => {'completed' => 1}, '$set' => {'updated_at' => Time.now}}
45
46
  if atomic_op
46
47
  op['$inc'].merge!(atomic_op.delete('$inc')) if atomic_op['$inc']
48
+ op['$set'].merge!(atomic_op.delete('$set')) if atomic_op['$set']
47
49
  op.merge!(atomic_op)
48
50
  end
49
51
  job_groups.update( {'_id' => gid}, op , {:upsert => true})
@@ -55,7 +57,8 @@ module Resque::Plugins::Groups
55
57
  job_groups.update( {'_id' => gid},
56
58
  {
57
59
  '$inc' => {'failed' => 1},
58
- '$push' => {'exceptions' => exception.inspect}
60
+ '$push' => {'exceptions' => exception.inspect},
61
+ '$set' => {'updated_at' => Time.now}
59
62
  }, {:upsert => true})
60
63
  #Resque.print_groups
61
64
  end
@@ -63,7 +66,8 @@ module Resque::Plugins::Groups
63
66
  def record_delayed_job(gid)
64
67
  job_groups.update( {'_id' => gid},
65
68
  {
66
- '$inc' => {'delayed' => 1}
69
+ '$inc' => {'delayed' => 1},
70
+ '$set' => {'updated_at' => Time.now}
67
71
  }, {:upsert => true})
68
72
  #Resque.print_groups
69
73
  end
@@ -71,7 +75,8 @@ module Resque::Plugins::Groups
71
75
  def delete_delayed_job(gid)
72
76
  job_groups.update( {'_id' => gid},
73
77
  {
74
- '$inc' => {'delayed' => -1}
78
+ '$inc' => {'delayed' => -1},
79
+ '$set' => {'updated_at' => Time.now}
75
80
  }, {:upsert => true})
76
81
  #Resque.print_groups
77
82
  end
@@ -2,6 +2,6 @@ require 'resque'
2
2
 
3
3
  module Resque::Plugins
4
4
  module Groups
5
- Version = '0.5'
5
+ Version = '0.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: resque-mongo-groups
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.5"
5
+ version: "0.6"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gheorghita Catalin Bordianu
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-24 00:00:00 +01:00
13
+ date: 2011-04-12 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements: []
85
85
 
86
86
  rubyforge_project: resque-mongo-groups
87
- rubygems_version: 1.6.1
87
+ rubygems_version: 1.6.2
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: Keeps track of groups of jobs and their completion status