fanforce-plugin-worker 2.0.0.rc11 → 2.0.0.rc12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e756e918d0ff2a7dc9070491506c6e61042f56f5
|
4
|
+
data.tar.gz: 5c88d554a6bf80df472c8af395665fe96f645d38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e59fab71af38e7301e2e890948f5dae785949464c3896ab2973283e2a7e745a0c5c03981283657a0832f1c67d2e4319c10213fd0541585c5276cc2b65227044d
|
7
|
+
data.tar.gz: 8d377a77dd2eebcd53477a974ebdde7aa13893fd4334aa3fb86c48a9882a33eab93f30e74b93bf93ba89e3061977c866f70fb06ee574a584616431cc24c8f293
|
@@ -24,7 +24,6 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_runtime_dependency 'uuid', '~> 2.3.7'
|
25
25
|
gem.add_runtime_dependency 'activesupport', '~> 4.1.6'
|
26
26
|
gem.add_runtime_dependency 'redis', '~> 3.1.0'
|
27
|
-
gem.add_runtime_dependency 'multi_json', '>= 1.7.2'
|
28
27
|
|
29
28
|
gem.add_runtime_dependency 'rest_client', '= 1.7.3'
|
30
29
|
|
@@ -7,6 +7,15 @@ class Fanforce::PluginWorker
|
|
7
7
|
@@log = Logger.new($stdout)
|
8
8
|
@@log.datetime_format = '%H:%M:%S'
|
9
9
|
@@log.formatter = proc do |severity, datetime, prog_name, msg| "#{datetime}: #{msg}\n" end
|
10
|
+
@@is_iron_worker = false
|
11
|
+
|
12
|
+
def self.is_iron_worker(bool)
|
13
|
+
@@is_iron_worker = bool
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.is_iron_worker?
|
17
|
+
@@is_iron_worker
|
18
|
+
end
|
10
19
|
|
11
20
|
def self.iron_token
|
12
21
|
@@iron[:token] || ENV['IRON_TOKEN']
|
@@ -40,8 +49,8 @@ class Fanforce::PluginWorker
|
|
40
49
|
def self.enqueue(queue_id, params, options={})
|
41
50
|
raise 'Params being sent to the queue must be a Hash' if !params.is_a?(Hash)
|
42
51
|
|
43
|
-
if [true,'true'].include?(ENV['
|
44
|
-
|
52
|
+
if [true,'true'].include?(ENV['FANFORCE_WORKER_SHOULD_RUN_LOCALLY_AND_INSTANTLY']) and !is_iron_worker?
|
53
|
+
run_locally_and_instantly(queue_id, params)
|
45
54
|
else
|
46
55
|
queue_id = Utils.iron_queue_id(queue_id)
|
47
56
|
retries = (options[:retries].present?) ? options.delete(:retries) : 0
|
@@ -49,7 +58,7 @@ class Fanforce::PluginWorker
|
|
49
58
|
end
|
50
59
|
end
|
51
60
|
|
52
|
-
def self.
|
61
|
+
def self.run_locally_and_instantly(queue_id, params)
|
53
62
|
exec_file = "#{Plugin.base_dir}/workers/#{queue_id}.rb"
|
54
63
|
raise "Ruby file is missing: #{exec_file}" if !File.exists?(exec_file)
|
55
64
|
raise "RACK_ENV must be development: #{ENV['RACK_ENV']}" if ENV['RACK_ENV'] != 'development'
|
@@ -58,7 +67,7 @@ class Fanforce::PluginWorker
|
|
58
67
|
end
|
59
68
|
|
60
69
|
def self.run(worker_data, min_execution_time=300, &code_block)
|
61
|
-
if [true,'true'].include?(ENV['
|
70
|
+
if [true,'true'].include?(ENV['FANFORCE_WORKER_SHOULD_RUN_LOCALLY_AND_INSTANTLY']) and !is_iron_worker?
|
62
71
|
RunnerLocal.new(worker_data, min_execution_time).run_job(&code_block)
|
63
72
|
else
|
64
73
|
Runner.new(worker_data, min_execution_time, &code_block)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fanforce-plugin-worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Clark
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 3.1.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: multi_json
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 1.7.2
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 1.7.2
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: rest_client
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|