cloudist 0.4.2 → 0.4.3

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cloudist}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ivan Vanderbyl"]
12
- s.date = %q{2011-05-24}
12
+ s.date = %q{2011-05-28}
13
13
  s.description = %q{Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, DaemonKit or your own custom application. Refer to github page for examples}
14
14
  s.email = %q{ivanvanderbyl@me.com}
15
15
  s.extra_rdoc_files = [
@@ -47,6 +47,6 @@ end
47
47
 
48
48
  Cloudist.signal_trap!
49
49
 
50
- Cloudist.start(:logging => false) {
50
+ Cloudist.start(:logging => false, :worker_prefetch => 2) {
51
51
  Cloudist.handle('make.sandwich').with(SandwichWorker)
52
52
  }
@@ -34,6 +34,9 @@ module Cloudist
34
34
  thread_local_accessor :listeners, :default => []
35
35
  thread_local_accessor :listener_instances, :default => {}
36
36
 
37
+ thread_local_accessor :worker_prefetch, :default => 1
38
+ thread_local_accessor :listener_prefetch, :default => 1
39
+
37
40
  # Start the Cloudist loop
38
41
  #
39
42
  # Cloudist.start {
@@ -53,6 +56,7 @@ module Cloudist
53
56
  #
54
57
  def start(options_or_connection = {}, &block)
55
58
  if options_or_connection.is_a?(Hash)
59
+ extract_cloudist_options!(options_or_connection)
56
60
  config = settings.update(options_or_connection)
57
61
  AMQP.start(config) do
58
62
  self.instance_eval(&block) if block_given?
@@ -63,6 +67,11 @@ module Cloudist
63
67
  end
64
68
  end
65
69
 
70
+ def extract_cloudist_options!(options)
71
+ self.worker_prefetch = options.delete(:worker_prefetch) || 1
72
+ self.listener_prefetch = options.delete(:listener_prefetch) || 1
73
+ end
74
+
66
75
  def connection
67
76
  AMQP.connection
68
77
  end
@@ -1,6 +1,15 @@
1
1
  module Cloudist
2
2
  class JobQueue < Cloudist::Queues::BasicQueue
3
3
 
4
+ def initialize(queue_name, options={})
5
+ options[:auto_delete] = false
6
+ options[:nowait] = false
7
+
8
+ @prefetch = Cloudist.worker_prefetch
9
+ puts "Prefetch: #{@prefetch}"
10
+ super(queue_name, options)
11
+ end
12
+
4
13
  # def initialize(queue_name, options={})
5
14
  # @prefetch = 1
6
15
  # # opts[:auto_delete] = false
@@ -4,7 +4,7 @@ module Cloudist
4
4
  options[:auto_delete] = true
5
5
  options[:nowait] = false
6
6
 
7
- @prefetch = 1
7
+ @prefetch = Cloudist.listener_prefetch
8
8
 
9
9
  super(queue_name, options)
10
10
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cloudist
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.2
5
+ version: 0.4.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ivan Vanderbyl
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-24 00:00:00 +10:00
13
+ date: 2011-05-28 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -259,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
259
  requirements:
260
260
  - - ">="
261
261
  - !ruby/object:Gem::Version
262
- hash: -987302179253893862
262
+ hash: 3218732857498604303
263
263
  segments:
264
264
  - 0
265
265
  version: "0"