hirefire-resource 0.10.0 → 1.0.0
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 +4 -4
- data/CHANGELOG.md +175 -0
- data/LICENSE +21 -66
- data/README.md +34 -78
- data/hirefire-resource.gemspec +21 -15
- data/lib/hirefire/configuration.rb +31 -0
- data/lib/hirefire/errors/job_queue_latency_unsupported.rb +12 -0
- data/lib/hirefire/errors.rb +9 -0
- data/lib/hirefire/hirefire.rb +15 -0
- data/lib/hirefire/macro/bunny.rb +55 -55
- data/lib/hirefire/macro/delayed_job.rb +80 -60
- data/lib/hirefire/macro/deprecated/bunny.rb +85 -0
- data/lib/hirefire/macro/deprecated/delayed_job.rb +62 -0
- data/lib/hirefire/macro/deprecated/good_job.rb +32 -0
- data/lib/hirefire/macro/deprecated/que.rb +76 -0
- data/lib/hirefire/macro/deprecated/queue_classic.rb +28 -0
- data/lib/hirefire/macro/deprecated/resque.rb +47 -0
- data/lib/hirefire/macro/deprecated/sidekiq.rb +138 -0
- data/lib/hirefire/macro/good_job.rb +48 -13
- data/lib/hirefire/macro/que.rb +56 -36
- data/lib/hirefire/macro/queue_classic.rb +86 -0
- data/lib/hirefire/macro/resque.rb +112 -24
- data/lib/hirefire/macro/sidekiq.rb +324 -74
- data/lib/hirefire/macro/solid_queue.rb +166 -0
- data/lib/hirefire/middleware.rb +50 -103
- data/lib/hirefire/railtie.rb +1 -1
- data/lib/hirefire/resource.rb +1 -47
- data/lib/hirefire/utility.rb +22 -0
- data/lib/hirefire/version.rb +5 -0
- data/lib/hirefire/web.rb +151 -0
- data/lib/hirefire/worker.rb +39 -0
- data/lib/hirefire-resource.rb +4 -9
- metadata +50 -24
- data/.github/workflows/main.yml +0 -16
- data/.gitignore +0 -5
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -49
- data/Rakefile +0 -4
- data/lib/hirefire/macro/qc.rb +0 -23
- data/lib/hirefire/macro/qu.rb +0 -27
data/lib/hirefire/middleware.rb
CHANGED
|
@@ -1,138 +1,85 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
3
5
|
module HireFire
|
|
4
6
|
class Middleware
|
|
5
|
-
# Initializes HireFire::Middleware.
|
|
6
|
-
#
|
|
7
|
-
# @param [Proc] app call with `env` to continue down the middleware stack.
|
|
8
|
-
#
|
|
9
7
|
def initialize(app)
|
|
10
8
|
@app = app
|
|
11
|
-
@
|
|
12
|
-
@path_prefix = get_path_prefix
|
|
9
|
+
@path_prefix = determine_path_prefix
|
|
13
10
|
end
|
|
14
11
|
|
|
15
|
-
# Intercepts and handles the /hirefire/test, /hirefire/development/info,
|
|
16
|
-
# and /hirefire/HIREFIRE_TOKEN/info paths. If none of these paths match,
|
|
17
|
-
# then then request will continue down the middleware stack.
|
|
18
|
-
#
|
|
19
|
-
# When HireFire::Resource.log_queue_metrics is enabled, and the HTTP_X_REQUEST_START
|
|
20
|
-
# header has been injected at the Heroku Router layer, queue time information will be
|
|
21
|
-
# logged to $stdout. This data can be used by the HireFire Logdrain with the
|
|
22
|
-
# Web.Logplex.QueueTime autoscaling strategy.
|
|
23
|
-
#
|
|
24
|
-
# Important: Don't set/update instance variables within this- or any underlying methods.
|
|
25
|
-
# Doing so may result in race conditions when using threaded application servers.
|
|
26
|
-
#
|
|
27
|
-
# @param [Hash] env containing request information.
|
|
28
|
-
#
|
|
29
12
|
def call(env)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if
|
|
33
|
-
|
|
34
|
-
elsif info_path?(env["PATH_INFO"])
|
|
35
|
-
build_info_response
|
|
36
|
-
else
|
|
37
|
-
@app.call(env)
|
|
13
|
+
process_request_queue_time(env)
|
|
14
|
+
|
|
15
|
+
if matches_hirefire_path?(env) || matches_info_path?(env)
|
|
16
|
+
return construct_info_response
|
|
38
17
|
end
|
|
18
|
+
|
|
19
|
+
@app.call(env)
|
|
39
20
|
end
|
|
40
21
|
|
|
41
22
|
private
|
|
42
23
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# @param [String] path_info the requested path.
|
|
46
|
-
# @return [Boolean] true if the requested path matches the test path.
|
|
47
|
-
#
|
|
48
|
-
def test_path?(path_info)
|
|
49
|
-
get_path(path_info) == "/hirefire/test"
|
|
24
|
+
def matches_hirefire_path?(env)
|
|
25
|
+
ENV["HIREFIRE_TOKEN"] && extract_path(env) == "/hirefire" && ENV["HIREFIRE_TOKEN"] == env["HTTP_HIREFIRE_TOKEN"]
|
|
50
26
|
end
|
|
51
27
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# @param [String] path_info the requested path.
|
|
55
|
-
# @return [Boolean] true if the requested path matches the info path.
|
|
56
|
-
#
|
|
57
|
-
def info_path?(path_info)
|
|
58
|
-
get_path(path_info) == "/hirefire/#{@token || "development"}/info"
|
|
28
|
+
def matches_info_path?(env)
|
|
29
|
+
ENV["HIREFIRE_TOKEN"] && extract_path(env) == "/hirefire/#{ENV["HIREFIRE_TOKEN"]}/info"
|
|
59
30
|
end
|
|
60
31
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# @param [String] path_info the requested path.
|
|
64
|
-
# @return [String] the path without the @path_prefix.
|
|
65
|
-
#
|
|
66
|
-
def get_path(path_info)
|
|
67
|
-
if @path_prefix
|
|
68
|
-
path_info.gsub(@path_prefix, "")
|
|
69
|
-
else
|
|
70
|
-
path_info
|
|
71
|
-
end
|
|
32
|
+
def extract_path(env)
|
|
33
|
+
@path_prefix ? env["PATH_INFO"].gsub(@path_prefix, "") : env["PATH_INFO"]
|
|
72
34
|
end
|
|
73
35
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
36
|
+
def construct_info_response
|
|
37
|
+
[
|
|
38
|
+
200,
|
|
39
|
+
{
|
|
40
|
+
"Content-Type" => "application/json",
|
|
41
|
+
"Cache-Control" => "must-revalidate, private, max-age=0",
|
|
42
|
+
"HireFire-Resource" => "Ruby-#{HireFire::VERSION}"
|
|
43
|
+
},
|
|
44
|
+
[
|
|
45
|
+
HireFire.configuration.workers.map do |worker|
|
|
46
|
+
{name: worker.name, value: worker.value}
|
|
47
|
+
end.to_json
|
|
48
|
+
]
|
|
49
|
+
]
|
|
84
50
|
end
|
|
85
51
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
# @return [String] in application/json format.
|
|
90
|
-
#
|
|
91
|
-
def build_info_response
|
|
92
|
-
entries = HireFire::Resource.dynos.map do |config|
|
|
93
|
-
%({"name":"#{config[:name]}","value":#{config[:value].call || "null"}})
|
|
94
|
-
end
|
|
52
|
+
def process_request_queue_time(env)
|
|
53
|
+
request_start = env["HTTP_X_REQUEST_START"]
|
|
95
54
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
body = "[" + entries.join(",") + "]"
|
|
55
|
+
if HireFire.configuration.web && ENV["HIREFIRE_TOKEN"] && request_start
|
|
56
|
+
request_queue_time = calculate_request_queue_time(request_start)
|
|
57
|
+
collect_request_queue_time(request_queue_time)
|
|
58
|
+
end
|
|
101
59
|
|
|
102
|
-
|
|
60
|
+
if HireFire.configuration.log_queue_metrics && request_start
|
|
61
|
+
request_queue_time = calculate_request_queue_time(request_start)
|
|
62
|
+
log_request_queue_time(request_queue_time)
|
|
63
|
+
end
|
|
103
64
|
end
|
|
104
65
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
66
|
+
def collect_request_queue_time(request_queue_time)
|
|
67
|
+
HireFire
|
|
68
|
+
.configuration
|
|
69
|
+
.web
|
|
70
|
+
.tap(&:start_dispatcher)
|
|
71
|
+
.add_to_buffer(request_queue_time)
|
|
111
72
|
end
|
|
112
73
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
# @param [String] the timestamp from HTTP_X_REQUEST_START.
|
|
116
|
-
#
|
|
117
|
-
def log_queue(value)
|
|
118
|
-
puts("[hirefire:router] queue=#{get_queue(value)}ms")
|
|
74
|
+
def log_request_queue_time(request_queue_time)
|
|
75
|
+
puts "[hirefire:router] queue=#{request_queue_time}ms"
|
|
119
76
|
end
|
|
120
77
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
#
|
|
124
|
-
# @param [String] the timestamp from HTTP_X_REQUEST_START.
|
|
125
|
-
# @return [Integer] the queue time in milliseconds.
|
|
126
|
-
#
|
|
127
|
-
def get_queue(value)
|
|
128
|
-
ms = (Time.now.to_f * 1000).to_i - value.to_i
|
|
129
|
-
ms < 0 ? 0 : ms
|
|
78
|
+
def calculate_request_queue_time(timestamp)
|
|
79
|
+
[(Time.now.to_f * 1000).to_i - timestamp.to_i, 0].max
|
|
130
80
|
end
|
|
131
81
|
|
|
132
|
-
|
|
133
|
-
# mounted under RAILS_RELATIVE_URL_ROOT.
|
|
134
|
-
#
|
|
135
|
-
def get_path_prefix
|
|
82
|
+
def determine_path_prefix
|
|
136
83
|
if defined?(Rails) && Rails.application.config.relative_url_root
|
|
137
84
|
Regexp.new("^" + Regexp.escape(Rails.application.config.relative_url_root))
|
|
138
85
|
end
|
data/lib/hirefire/railtie.rb
CHANGED
data/lib/hirefire/resource.rb
CHANGED
|
@@ -1,51 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module HireFire
|
|
4
|
-
|
|
5
|
-
extend self
|
|
6
|
-
|
|
7
|
-
# This option, when enabled, will write queue metrics to $stdout,
|
|
8
|
-
# and is only required when using the Web.Logplex.QueueTime strategy.
|
|
9
|
-
#
|
|
10
|
-
# @param [Boolean] Whether or not the queue metrics should be logged.
|
|
11
|
-
#
|
|
12
|
-
attr_writer :log_queue_metrics
|
|
13
|
-
|
|
14
|
-
# @return [Boolean] True if the queue metrics option is enabled.
|
|
15
|
-
#
|
|
16
|
-
def log_queue_metrics
|
|
17
|
-
@log_queue_metrics ||= false
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# @return [Array] The configured dynos.
|
|
21
|
-
#
|
|
22
|
-
def dynos
|
|
23
|
-
@dynos ||= []
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Configures HireFire::Resource.
|
|
27
|
-
#
|
|
28
|
-
# @example Resource Configuration
|
|
29
|
-
# HireFire::Resource.configure do |config|
|
|
30
|
-
# config.log_queue_metrics = true # disabled by default
|
|
31
|
-
# config.dyno(:worker) do
|
|
32
|
-
# # Macro or Custom logic for the :worker dyno here..
|
|
33
|
-
# end
|
|
34
|
-
# end
|
|
35
|
-
#
|
|
36
|
-
# @yield [HireFire::Resource] to allow for block-style configuration.
|
|
37
|
-
#
|
|
38
|
-
def configure
|
|
39
|
-
yield self
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Will be used through block-style configuration with the `configure` method.
|
|
43
|
-
#
|
|
44
|
-
# @param [Symbol, String] name the name of the dyno as defined in the Procfile.
|
|
45
|
-
# @param [Proc] block an Integer containing the value calculation logic.
|
|
46
|
-
#
|
|
47
|
-
def dyno(name, &block)
|
|
48
|
-
dynos << {name: name, value: block}
|
|
49
|
-
end
|
|
50
|
-
end
|
|
4
|
+
Resource = HireFire
|
|
51
5
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HireFire
|
|
4
|
+
module Utility
|
|
5
|
+
extend self
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def normalize_queues(queues, allow_empty:)
|
|
10
|
+
queues = queues.flatten.map { |queue| queue.to_s.strip }
|
|
11
|
+
|
|
12
|
+
if queues.any?
|
|
13
|
+
Set.new(queues)
|
|
14
|
+
elsif allow_empty
|
|
15
|
+
Set.new
|
|
16
|
+
else
|
|
17
|
+
raise HireFire::Errors::MissingQueueError,
|
|
18
|
+
"No queue was specified. Please specify at least one queue."
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/hirefire/web.rb
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "net/http"
|
|
5
|
+
|
|
6
|
+
module HireFire
|
|
7
|
+
class Web
|
|
8
|
+
class DispatchError < StandardError; end
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
@buffer = {}
|
|
12
|
+
@mutex = Mutex.new
|
|
13
|
+
@dispatcher_running = false
|
|
14
|
+
@dispatch_interval = 1
|
|
15
|
+
@dispatch_timeout = 5
|
|
16
|
+
@buffer_ttl = 60
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def start_dispatcher
|
|
20
|
+
@mutex.synchronize do
|
|
21
|
+
return false if @dispatcher_running
|
|
22
|
+
@dispatcher_running = true
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
logger.info "[HireFire] Starting web metrics dispatcher."
|
|
26
|
+
|
|
27
|
+
@dispatcher = Thread.new do
|
|
28
|
+
while dispatcher_running?
|
|
29
|
+
dispatch_buffer
|
|
30
|
+
sleep @dispatch_interval
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def stop_dispatcher
|
|
38
|
+
@mutex.synchronize do
|
|
39
|
+
return false unless @dispatcher_running
|
|
40
|
+
@dispatcher_running = false
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
@dispatcher.join(@dispatch_timeout)
|
|
44
|
+
@dispatcher = nil
|
|
45
|
+
|
|
46
|
+
flush_buffer
|
|
47
|
+
|
|
48
|
+
logger.info "[HireFire] Web metrics dispatcher stopped."
|
|
49
|
+
|
|
50
|
+
true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def dispatcher_running?
|
|
54
|
+
@mutex.synchronize { @dispatcher_running }
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def add_to_buffer(request_queue_time)
|
|
58
|
+
@mutex.synchronize do
|
|
59
|
+
timestamp = Time.now.to_i
|
|
60
|
+
@buffer[timestamp] ||= []
|
|
61
|
+
@buffer[timestamp] << request_queue_time
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def flush_buffer
|
|
68
|
+
@mutex.synchronize do
|
|
69
|
+
@buffer.tap { @buffer = {} }
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def dispatch_buffer
|
|
74
|
+
return unless (buffer = flush_buffer).any?
|
|
75
|
+
logger.info "[HireFire] Dispatching web metrics: #{buffer}" if ENV["HIREFIRE_VERBOSE"]
|
|
76
|
+
submit_buffer(buffer)
|
|
77
|
+
rescue => e
|
|
78
|
+
repopulate_buffer(buffer)
|
|
79
|
+
logger.error "[HireFire] Error while dispatching web metrics: #{e.message}"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def repopulate_buffer(buffer)
|
|
83
|
+
now = Time.now.to_i
|
|
84
|
+
@mutex.synchronize do
|
|
85
|
+
buffer.each do |timestamp, request_queue_times|
|
|
86
|
+
next if timestamp < now - @buffer_ttl
|
|
87
|
+
@buffer[timestamp] ||= []
|
|
88
|
+
@buffer[timestamp].concat(request_queue_times)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def submit_buffer(buffer)
|
|
94
|
+
hirefire_token = ENV["HIREFIRE_TOKEN"]
|
|
95
|
+
|
|
96
|
+
unless hirefire_token
|
|
97
|
+
raise DispatchError, <<~MSG
|
|
98
|
+
The HIREFIRE_TOKEN environment variable is not set. Unable to submit
|
|
99
|
+
Request Queue Time metric data. The HIREFIRE_TOKEN can be found in
|
|
100
|
+
the HireFire Web UI in the web dyno manager settings.
|
|
101
|
+
MSG
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
uri = URI.parse(ENV.fetch("HIREFIRE_DISPATCH_URL", "https://logdrain.hirefire.io/"))
|
|
105
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
106
|
+
http.use_ssl = true
|
|
107
|
+
http.read_timeout = @dispatch_timeout
|
|
108
|
+
http.open_timeout = @dispatch_timeout
|
|
109
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
|
110
|
+
request["Content-Type"] = "application/json"
|
|
111
|
+
request["HireFire-Token"] = ENV["HIREFIRE_TOKEN"]
|
|
112
|
+
request["HireFire-Resource"] = "Ruby-#{HireFire::VERSION}"
|
|
113
|
+
request.body = buffer.to_json
|
|
114
|
+
response = http.request(request)
|
|
115
|
+
|
|
116
|
+
case response
|
|
117
|
+
when Net::HTTPSuccess
|
|
118
|
+
adjust_parameters(response)
|
|
119
|
+
response
|
|
120
|
+
when Net::HTTPServerError
|
|
121
|
+
raise DispatchError, "Server responded with #{response.code} status."
|
|
122
|
+
else
|
|
123
|
+
raise DispatchError, "Unexpected response code #{response.code}."
|
|
124
|
+
end
|
|
125
|
+
rescue Timeout::Error
|
|
126
|
+
raise DispatchError, "Request timed out."
|
|
127
|
+
rescue SocketError => e
|
|
128
|
+
raise DispatchError, "Network error occurred (#{e.message})."
|
|
129
|
+
rescue => e
|
|
130
|
+
raise DispatchError, "An unexpected error occurred (#{e.message})."
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def adjust_parameters(response)
|
|
134
|
+
if response.key?("HireFire-Resource-Dispatch-Interval")
|
|
135
|
+
@dispatch_interval = response["HireFire-Resource-Dispatch-Interval"].to_i
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if response.key?("HireFire-Resource-Dispatch-Timeout")
|
|
139
|
+
@dispatch_timeout = response["HireFire-Resource-Dispatch-Timeout"].to_i
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if response.key?("HireFire-Resource-Buffer-TTL")
|
|
143
|
+
@buffer_ttl = response["HireFire-Resource-Buffer-TTL"].to_i
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def logger
|
|
148
|
+
HireFire.configuration.logger
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HireFire
|
|
4
|
+
class Worker
|
|
5
|
+
class InvalidDynoNameError < StandardError; end
|
|
6
|
+
|
|
7
|
+
class MissingDynoBlockError < StandardError; end
|
|
8
|
+
|
|
9
|
+
PROCESS_NAME_PATTERN = /\A[a-zA-Z][a-zA-Z0-9_]{0,29}\z/
|
|
10
|
+
|
|
11
|
+
attr_reader :name
|
|
12
|
+
|
|
13
|
+
def initialize(name, &block)
|
|
14
|
+
validate(name, &block)
|
|
15
|
+
@name = name
|
|
16
|
+
@block = block
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def value
|
|
20
|
+
@block.call
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def validate(name, &block)
|
|
26
|
+
unless name.to_s.match?(PROCESS_NAME_PATTERN)
|
|
27
|
+
raise InvalidDynoNameError,
|
|
28
|
+
"Invalid name for HireFire::Worker.new(#{name}, &block). " \
|
|
29
|
+
"Ensure it matches the Procfile process name (i.e. web, worker)."
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
unless block
|
|
33
|
+
raise MissingDynoBlockError,
|
|
34
|
+
"Missing block for HireFire::Worker.new(#{name}, &block). " \
|
|
35
|
+
"Ensure that you provide a block that returns the job queue metric."
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/hirefire-resource.rb
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative "hirefire/utility"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Dir[File.expand_path("../hirefire/**/*.rb", __FILE__)].sort.each do |file|
|
|
6
|
+
next if file.include?("railtie.rb") && !defined?(Rails::Railtie)
|
|
7
|
+
require file
|
|
7
8
|
end
|
|
8
|
-
|
|
9
|
-
%w[delayed_job resque sidekiq qu qc bunny que good_job].each do |file|
|
|
10
|
-
require "#{HIREFIRE_PATH}/macro/#{file}"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
require "#{HIREFIRE_PATH}/railtie" if defined?(Rails::Railtie)
|
metadata
CHANGED
|
@@ -1,51 +1,77 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hirefire-resource
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael van Rooijen
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
date: 2024-01-23 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: appraisal
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2'
|
|
27
|
+
description:
|
|
28
|
+
email:
|
|
29
|
+
- support@hirefire.io
|
|
15
30
|
executables: []
|
|
16
31
|
extensions: []
|
|
17
32
|
extra_rdoc_files: []
|
|
18
33
|
files:
|
|
19
|
-
- ".github/workflows/main.yml"
|
|
20
|
-
- ".gitignore"
|
|
21
34
|
- CHANGELOG.md
|
|
22
|
-
- Gemfile
|
|
23
|
-
- Gemfile.lock
|
|
24
35
|
- LICENSE
|
|
25
36
|
- README.md
|
|
26
|
-
- Rakefile
|
|
27
37
|
- hirefire-resource.gemspec
|
|
28
38
|
- lib/hirefire-resource.rb
|
|
39
|
+
- lib/hirefire/configuration.rb
|
|
40
|
+
- lib/hirefire/errors.rb
|
|
41
|
+
- lib/hirefire/errors/job_queue_latency_unsupported.rb
|
|
42
|
+
- lib/hirefire/hirefire.rb
|
|
29
43
|
- lib/hirefire/macro/bunny.rb
|
|
30
44
|
- lib/hirefire/macro/delayed_job.rb
|
|
45
|
+
- lib/hirefire/macro/deprecated/bunny.rb
|
|
46
|
+
- lib/hirefire/macro/deprecated/delayed_job.rb
|
|
47
|
+
- lib/hirefire/macro/deprecated/good_job.rb
|
|
48
|
+
- lib/hirefire/macro/deprecated/que.rb
|
|
49
|
+
- lib/hirefire/macro/deprecated/queue_classic.rb
|
|
50
|
+
- lib/hirefire/macro/deprecated/resque.rb
|
|
51
|
+
- lib/hirefire/macro/deprecated/sidekiq.rb
|
|
31
52
|
- lib/hirefire/macro/good_job.rb
|
|
32
|
-
- lib/hirefire/macro/qc.rb
|
|
33
|
-
- lib/hirefire/macro/qu.rb
|
|
34
53
|
- lib/hirefire/macro/que.rb
|
|
54
|
+
- lib/hirefire/macro/queue_classic.rb
|
|
35
55
|
- lib/hirefire/macro/resque.rb
|
|
36
56
|
- lib/hirefire/macro/sidekiq.rb
|
|
57
|
+
- lib/hirefire/macro/solid_queue.rb
|
|
37
58
|
- lib/hirefire/middleware.rb
|
|
38
59
|
- lib/hirefire/railtie.rb
|
|
39
60
|
- lib/hirefire/resource.rb
|
|
40
|
-
|
|
61
|
+
- lib/hirefire/utility.rb
|
|
62
|
+
- lib/hirefire/version.rb
|
|
63
|
+
- lib/hirefire/web.rb
|
|
64
|
+
- lib/hirefire/worker.rb
|
|
65
|
+
homepage: https://hirefire.io
|
|
41
66
|
licenses:
|
|
42
|
-
-
|
|
67
|
+
- MIT
|
|
43
68
|
metadata:
|
|
44
|
-
homepage_uri: https://
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
69
|
+
homepage_uri: https://hirefire.io
|
|
70
|
+
documentation_uri: https://www.rubydoc.info/gems/hirefire-resource
|
|
71
|
+
changelog_uri: https://github.com/hirefire/hirefire-resource-ruby/blob/master/CHANGELOG.md
|
|
72
|
+
source_code_uri: https://github.com/hirefire/hirefire-resource-ruby
|
|
73
|
+
bug_tracker_uri: https://github.com/hirefire/hirefire-resource-ruby/issues
|
|
74
|
+
post_install_message:
|
|
49
75
|
rdoc_options: []
|
|
50
76
|
require_paths:
|
|
51
77
|
- lib
|
|
@@ -53,15 +79,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
53
79
|
requirements:
|
|
54
80
|
- - ">="
|
|
55
81
|
- !ruby/object:Gem::Version
|
|
56
|
-
version:
|
|
82
|
+
version: 2.7.0
|
|
57
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
84
|
requirements:
|
|
59
85
|
- - ">="
|
|
60
86
|
- !ruby/object:Gem::Version
|
|
61
87
|
version: '0'
|
|
62
88
|
requirements: []
|
|
63
|
-
rubygems_version: 3.
|
|
64
|
-
signing_key:
|
|
89
|
+
rubygems_version: 3.5.3
|
|
90
|
+
signing_key:
|
|
65
91
|
specification_version: 4
|
|
66
|
-
summary:
|
|
92
|
+
summary: HireFire integration library for Ruby applications
|
|
67
93
|
test_files: []
|
data/.github/workflows/main.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name: Ruby
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v2
|
|
10
|
-
- name: Set up Ruby
|
|
11
|
-
uses: ruby/setup-ruby@v1
|
|
12
|
-
with:
|
|
13
|
-
ruby-version: 3.0.2
|
|
14
|
-
bundler-cache: true
|
|
15
|
-
- name: Run standardrb
|
|
16
|
-
run: bundle exec rake standard
|