delayed_job_ironmq 0.1.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -53,7 +53,7 @@ Then in one of your controllers:
53
53
 
54
54
  ```ruby
55
55
  user = User.new
56
- user.delay.bg_stuff
56
+ user.delay.background_stuff
57
57
  ```
58
58
 
59
59
  ## Start worker process
data/VERSION CHANGED
@@ -1 +1,2 @@
1
- 0.1.4
1
+ 1.0.0
2
+
@@ -31,8 +31,8 @@ module Delayed
31
31
 
32
32
  def find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
33
33
  Delayed::Worker.available_priorities.each do |priority|
34
- messages = ironmq.messages.get(queue_name: queue_name(priority), n: 1)
35
- return [Delayed::Backend::Ironmq::Job.new(messages[0])] if messages[0]
34
+ message = ironmq.queue(queue_name(priority)).get
35
+ return [Delayed::Backend::Ironmq::Job.new(message)] if message
36
36
  end
37
37
  []
38
38
  end
@@ -41,10 +41,10 @@ module Delayed
41
41
  deleted = 0
42
42
  Delayed::Worker.available_priorities.each do |priority|
43
43
  loop do
44
- msgs = ironmq.messages.get(n: 1000, queue_name: queue_name(priority))
44
+ msgs = ironmq.queue(queue_name(priority)).get(:n => 1000)
45
45
  break if msgs.blank?
46
46
  msgs.each do |msg|
47
- ironmq.messages.delete(msg.id, queue_name: queue_name(priority))
47
+ msg.delete
48
48
  deleted += 1
49
49
  end
50
50
  end
@@ -69,4 +69,4 @@ module Delayed
69
69
  end
70
70
  end
71
71
  end
72
- end
72
+ end
@@ -20,9 +20,9 @@ module Delayed
20
20
 
21
21
  def initialize(data = {})
22
22
  puts "[init] Delayed::Backend::Ironmq"
23
- @id = nil
23
+ @msg = nil
24
24
  if data.is_a?(IronMQ::Message)
25
- @id = data.id
25
+ @mgs = data
26
26
  data = JSON.load(data.body)
27
27
  end
28
28
 
@@ -62,12 +62,12 @@ module Delayed
62
62
  end
63
63
  payload = JSON.dump(@attributes)
64
64
 
65
- ironmq.messages.delete(@id, queue_name: queue_name) if @id.present?
66
- ironmq.messages.post(payload,
67
- timeout: @timeout,
68
- queue_name: queue_name,
69
- delay: @delay,
70
- expires_in: @expires_in)
65
+ @msg.delete if @msg
66
+
67
+ ironmq.queue(queue_name).post(payload,
68
+ :timeout => @timeout,
69
+ :delay => @delay,
70
+ :expires_in => @expires_in)
71
71
  true
72
72
  end
73
73
 
@@ -76,9 +76,9 @@ module Delayed
76
76
  end
77
77
 
78
78
  def destroy
79
- if @id
80
- puts "job destroyed! #{@id.inspect}"
81
- ironmq.messages.delete(@id, queue_name: queue_name) if @id.present?
79
+ if @msg
80
+ puts "job destroyed! #{@msg.id}"
81
+ @msg.delete
82
82
  end
83
83
  end
84
84
 
@@ -120,4 +120,4 @@ module Delayed
120
120
  end
121
121
  end
122
122
  end
123
- end
123
+ end
metadata CHANGED
@@ -1,69 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_ironmq
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Alexander Shapiotko
9
13
  - Iron.io, Inc
10
14
  autorequire:
11
15
  bindir: bin
12
16
  cert_chain: []
13
- date: 2012-08-11 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-03-22 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
16
22
  name: iron_mq
17
- requirement: &70165371264220 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
18
24
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: 1.4.0
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 4
30
+ - 0
31
+ - 0
32
+ version: 4.0.0
23
33
  type: :runtime
24
34
  prerelease: false
25
- version_requirements: *70165371264220
26
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
27
37
  name: delayed_job
28
- requirement: &70165371263400 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
29
39
  none: false
30
- requirements:
40
+ requirements:
31
41
  - - ~>
32
- - !ruby/object:Gem::Version
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 3
45
+ - 0
46
+ - 0
33
47
  version: 3.0.0
34
48
  type: :runtime
35
49
  prerelease: false
36
- version_requirements: *70165371263400
37
- - !ruby/object:Gem::Dependency
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
38
52
  name: rspec
39
- requirement: &70165371262740 !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
40
54
  none: false
41
- requirements:
42
- - - ! '>='
43
- - !ruby/object:Gem::Version
44
- version: '2.0'
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 2
60
+ - 0
61
+ version: "2.0"
45
62
  type: :development
46
63
  prerelease: false
47
- version_requirements: *70165371262740
48
- - !ruby/object:Gem::Dependency
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
49
66
  name: jeweler2
50
- requirement: &70165371262240 !ruby/object:Gem::Requirement
67
+ requirement: &id004 !ruby/object:Gem::Requirement
51
68
  none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ version: "0"
56
75
  type: :development
57
76
  prerelease: false
58
- version_requirements: *70165371262240
77
+ version_requirements: *id004
59
78
  description: IronMQ backend for delayed_job
60
79
  email: info@iron.io
61
80
  executables: []
81
+
62
82
  extensions: []
63
- extra_rdoc_files:
83
+
84
+ extra_rdoc_files:
64
85
  - LICENSE
65
86
  - README.md
66
- files:
87
+ files:
67
88
  - LICENSE
68
89
  - README.md
69
90
  - VERSION
@@ -75,31 +96,38 @@ files:
75
96
  - lib/delayed/serialization/ironmq.rb
76
97
  - lib/delayed_job_ironmq.rb
77
98
  - spec/.gitkeep
99
+ has_rdoc: true
78
100
  homepage: https://github.com/thousandsofthem/delayed_job_ironmq
79
101
  licenses: []
102
+
80
103
  post_install_message:
81
104
  rdoc_options: []
82
- require_paths:
105
+
106
+ require_paths:
83
107
  - lib
84
- required_ruby_version: !ruby/object:Gem::Requirement
108
+ required_ruby_version: !ruby/object:Gem::Requirement
85
109
  none: false
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- segments:
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: -79827836642847513
114
+ segments:
91
115
  - 0
92
- hash: 2357096919605816309
93
- required_rubygems_version: !ruby/object:Gem::Requirement
116
+ version: "0"
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
118
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ segments:
123
+ - 0
124
+ version: "0"
99
125
  requirements: []
126
+
100
127
  rubyforge_project:
101
- rubygems_version: 1.8.10
128
+ rubygems_version: 1.3.7
102
129
  signing_key:
103
130
  specification_version: 3
104
131
  summary: IronMQ backend for delayed_job
105
132
  test_files: []
133
+