coney_island 0.5 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a26ad1b67c4398ff19bfa0a046baad39b2835239
4
- data.tar.gz: ddf7ec8905fbe74bc34da0194e6b393bc70434c9
3
+ metadata.gz: 9b268c2c6635a2b24dca5298f43937dd2d9d410f
4
+ data.tar.gz: f1625c8b2a24268d9161c4a569c38c4f890dc264
5
5
  SHA512:
6
- metadata.gz: acb5bce0a1244a000c99dee2096c8ffcd1e66d2da05b682ab462d45e9b2ec4302dfb844ccb2b0f66a9d412c182cc24e6eade96efc6c0cddeef6be02c7c044955
7
- data.tar.gz: 17fe8d09044f6bf4576112e3de4155a7c71b60e1b75aec2a6589ce9e3f3057eb86f1d49c09bd759a71d692bcf89b5d46084e378aa92863824f14818241a58b88
6
+ metadata.gz: e8578848be730f24c738d135dea8215eee0405f203444c21321f2717f05076d9789ff19238b55b7e870e1fa71a6ae12fa8b232ff57a1b398ed644d2043781e9d
7
+ data.tar.gz: 4a018053eae956c62b0d6518594505ae04a01477521571f3f0542ef4d59422e9567ff666b16b92c1b5d0a34f91f5790f7bb8e3f4fdfe9b2382aef2db23ea2019
@@ -27,7 +27,7 @@ module ConeyIsland
27
27
  def self.tcp_connection_retry_limit=(limit)
28
28
  @tcp_connection_retry_limit = limit
29
29
  end
30
-
30
+
31
31
  def self.tcp_connection_retry_limit
32
32
  @tcp_connection_retry_limit ||= 6
33
33
  end
@@ -35,7 +35,7 @@ module ConeyIsland
35
35
  def self.tcp_connection_retry_interval=(interval)
36
36
  @tcp_connection_retry_interval = interval
37
37
  end
38
-
38
+
39
39
  def self.tcp_connection_retry_interval
40
40
  @tcp_connection_retry_interval ||= 10
41
41
  end
@@ -114,6 +114,4 @@ require 'coney_island/notifiers/honeybadger_notifier'
114
114
  require 'coney_island/worker'
115
115
  require 'coney_island/submitter'
116
116
  require 'coney_island/job_argument_error'
117
- if defined? ActiveJob::QueueAdapters
118
- require 'coney_island/queue_adapters'
119
- end
117
+ require 'coney_island/railtie' if defined?(Rails)
@@ -0,0 +1,32 @@
1
+ class ConeyIslandAdapter
2
+ # == ConeyIsland adapter for Active Job
3
+ #
4
+ # ConeyIsland is an industrial-strength background worker system for Rails using RabbitMQ. Read more about
5
+ # {here}[http://edraut.github.io/coney_island/].
6
+ #
7
+ # To use ConeyIsland set the queue_adapter config to +:coney_island+.
8
+ #
9
+ # Rails.application.config.active_job.queue_adapter = :coney_island
10
+ class << self
11
+ def enqueue(job) #:nodoc:
12
+ ConeyIsland::Worker.submit JobWrapper, :perform, args: [ job.arguments ], work_queue: job.queue_name, timeout: get_timeout_from_args(job)
13
+ end
14
+
15
+ def enqueue_at(job, timestamp) #:nodoc:
16
+ delay = timestamp - Time.current.to_f
17
+ ConeyIsland::Worker.submit JobWrapper, :perform, args: [ job.arguments ], work_queue: job.queue_name, delay: delay, timeout: get_timeout_from_args(job)
18
+ end
19
+
20
+ def get_timeout_from_args(job)
21
+ job.arguments['timeout']
22
+ end
23
+ end
24
+
25
+ class JobWrapper #:nodoc:
26
+ class << self
27
+ def perform(job_data)
28
+ Base.execute job_data
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ require 'coney_island/coney_island_adapter'
2
+ module ConeyIsland
3
+ class Railtie < Rails::Railtie
4
+ initializer "coney_island.coney_island_adapter" do
5
+ ActiveJob::QueueAdapters.send :autoload, :ConeyIslandAdapter
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module ConeyIsland
2
- VERSION = "0.5"
2
+ VERSION = "0.6"
3
3
  end
@@ -0,0 +1,2 @@
1
+ ConeyIsland::Submitter.submit! about to iterate over this many jobs: 1
2
+ Failed to connecto to RabbitMQ Attempt #1 time(s), trying again in 0 seconds...
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coney_island
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-13 00:00:00.000000000 Z
12
+ date: 2015-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -108,10 +108,11 @@ files:
108
108
  - Rakefile
109
109
  - bin/coney_island
110
110
  - lib/coney_island.rb
111
+ - lib/coney_island/coney_island_adapter.rb
111
112
  - lib/coney_island/job_argument_error.rb
112
113
  - lib/coney_island/notifiers/airbrake_notifier.rb
113
114
  - lib/coney_island/notifiers/honeybadger_notifier.rb
114
- - lib/coney_island/queue_adapter.rb
115
+ - lib/coney_island/railtie.rb
115
116
  - lib/coney_island/submitter.rb
116
117
  - lib/coney_island/version.rb
117
118
  - lib/coney_island/worker.rb
@@ -147,6 +148,7 @@ files:
147
148
  - test/dummy/config/routes.rb
148
149
  - test/dummy/config/secrets.yml
149
150
  - test/dummy/db/test.sqlite3
151
+ - test/dummy/log/test.log
150
152
  - test/dummy/public/404.html
151
153
  - test/dummy/public/422.html
152
154
  - test/dummy/public/500.html
@@ -211,6 +213,7 @@ test_files:
211
213
  - test/dummy/config/secrets.yml
212
214
  - test/dummy/config.ru
213
215
  - test/dummy/db/test.sqlite3
216
+ - test/dummy/log/test.log
214
217
  - test/dummy/public/404.html
215
218
  - test/dummy/public/422.html
216
219
  - test/dummy/public/500.html
@@ -1,36 +0,0 @@
1
- module ActiveJob
2
- module QueueAdapters
3
- # == ConeyIsland adapter for Active Job
4
- #
5
- # ConeyIsland is an industrial-strength background worker system for Rails using RabbitMQ. Read more about
6
- # {here}[http://edraut.github.io/coney_island/].
7
- #
8
- # To use ConeyIsland set the queue_adapter config to +:coney_island+.
9
- #
10
- # Rails.application.config.active_job.queue_adapter = :coney_island
11
- class ConeyIslandAdapter
12
- class << self
13
- def enqueue(job) #:nodoc:
14
- ConeyIsland::Worker.submit JobWrapper, :perform, args: [ job.arguments ], work_queue: job.queue_name, timeout: get_timeout_from_args(job)
15
- end
16
-
17
- def enqueue_at(job, timestamp) #:nodoc:
18
- delay = timestamp - Time.current.to_f
19
- ConeyIsland::Worker.submit JobWrapper, :perform, args: [ job.arguments ], work_queue: job.queue_name, delay: delay, timeout: get_timeout_from_args(job)
20
- end
21
-
22
- def get_timeout_from_args(job)
23
- job.arguments['timeout']
24
- end
25
- end
26
-
27
- class JobWrapper #:nodoc:
28
- class << self
29
- def perform(job_data)
30
- Base.execute job_data
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end