derfred-workling 0.4.9.4 → 0.4.9.5
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/lib/workling/clients/spawn_client.rb +3 -4
- data/lib/workling.rb +12 -12
- metadata +1 -1
@@ -26,16 +26,15 @@ module Workling
|
|
26
26
|
end
|
27
27
|
|
28
28
|
cattr_writer :options
|
29
|
-
def options
|
30
|
-
return @@options if defined?(@@options)
|
29
|
+
def self.options
|
31
30
|
# use thread for development and test modes. easier to hunt down exceptions that way.
|
32
|
-
@@options
|
31
|
+
@@options ||= { :method => (RAILS_ENV == "test" || RAILS_ENV == "development" ? :fork : :thread) }
|
33
32
|
end
|
34
33
|
|
35
34
|
include Spawn if installed?
|
36
35
|
|
37
36
|
def dispatch(clazz, method, options = {})
|
38
|
-
spawn(
|
37
|
+
spawn(SpawnClient.options) do # exceptions are trapped in here.
|
39
38
|
Workling.find(clazz, method).dispatch_to_worker_method(method, options)
|
40
39
|
end
|
41
40
|
|
data/lib/workling.rb
CHANGED
@@ -84,40 +84,40 @@ module Workling
|
|
84
84
|
def self.select_and_build_client
|
85
85
|
case(Workling.config[:client])
|
86
86
|
when 'amqp'
|
87
|
-
Workling::Clients::AmqpClient
|
87
|
+
Workling::Clients::AmqpClient.new
|
88
88
|
|
89
89
|
when 'amqp_exchange'
|
90
|
-
Workling::Clients::AmqpExchangeClient
|
90
|
+
Workling::Clients::AmqpExchangeClient.new
|
91
91
|
|
92
92
|
when 'memcache', 'starling'
|
93
|
-
Workling::Clients::MemcacheQueueClient
|
93
|
+
Workling::Clients::MemcacheQueueClient.new
|
94
94
|
|
95
95
|
when 'memory_queue' # this one is pretty useles...
|
96
|
-
Workling::Clients::MemoryQueueClient
|
96
|
+
Workling::Clients::MemoryQueueClient.new
|
97
97
|
|
98
98
|
when 'sqs'
|
99
|
-
Workling::Clients::SqsClient
|
99
|
+
Workling::Clients::SqsClient.new
|
100
100
|
|
101
101
|
when 'xmpp'
|
102
|
-
Workling::Clients::XmppClient
|
102
|
+
Workling::Clients::XmppClient.new
|
103
103
|
|
104
104
|
when 'backgroundjob'
|
105
|
-
Workling::Clients::BackgroundjobClient
|
105
|
+
Workling::Clients::BackgroundjobClient.new
|
106
106
|
|
107
107
|
when 'not_remote'
|
108
|
-
Workling::Clients::NotRemoteClient
|
108
|
+
Workling::Clients::NotRemoteClient.new
|
109
109
|
|
110
110
|
when 'not'
|
111
|
-
Workling::Clients::NotClient
|
111
|
+
Workling::Clients::NotClient.new
|
112
112
|
|
113
113
|
when 'spawn'
|
114
|
-
Workling::Clients::SpawnClient
|
114
|
+
Workling::Clients::SpawnClient.new
|
115
115
|
|
116
116
|
when 'thread'
|
117
|
-
Workling::Clients::ThreadClient
|
117
|
+
Workling::Clients::ThreadClient.new
|
118
118
|
|
119
119
|
when 'rudeq'
|
120
|
-
Workling::Clients::RudeQClient
|
120
|
+
Workling::Clients::RudeQClient.new
|
121
121
|
|
122
122
|
else
|
123
123
|
select_and_build_default_client
|