herdst_worker 0.2.9 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/herdst_worker +4 -0
- data/bin/herdst_worker_console +4 -0
- data/lib/herdst_worker/adapters/database.rb +1 -1
- data/lib/herdst_worker/adapters/facade.rb +0 -2
- data/lib/herdst_worker/adapters/sentry.rb +52 -7
- data/lib/herdst_worker/queue/facade.rb +1 -1
- data/lib/herdst_worker/queue/processor.rb +1 -1
- data/lib/herdst_worker/queue/runner.rb +1 -1
- data/lib/herdst_worker/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d7c07f5b245fc06edb5fd91c9fdae774f33d616534af631184d41aac7049b44
|
4
|
+
data.tar.gz: 6d00f8b2b5fc193c0189144d0af97861308ca389b3d19e83a9ae778f43e21288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40bf0b6a69d6bbff8b99238b6e4ff460f8bc4a49d16dc8a983c2d5f116daecacd9962bfaa4536935c3165aaa5192049c3f22bc6aa1d2cec99abf5d06435d745a
|
7
|
+
data.tar.gz: d340637481c6d7c308d7b86f66eea9b11ca5f357a4e08237f2f90933f820b6bf30a899485edf8dfce95677a78280eae1804395cc8f91ff6313441f09f9593f5c
|
data/bin/herdst_worker
CHANGED
@@ -15,6 +15,10 @@ queue_enabled = arg_pair["queue_enabled"] == "false" ? false : true
|
|
15
15
|
raise "Please specify a name for the application E.g. --name=[name]" unless application_name
|
16
16
|
raise "Please specify a family for the application E.g. --family=[family]" unless application_family
|
17
17
|
|
18
|
+
ENV["ENV"] = application_env
|
19
|
+
ENV["WORKER_ENV"] = application_env
|
20
|
+
ENV["RAILS_ENV"] = application_env
|
21
|
+
|
18
22
|
require_relative "../lib/herdst_worker"
|
19
23
|
|
20
24
|
application_instance = HerdstWorker::Application.new(application_env, application_name, application_family, queue_enabled)
|
data/bin/herdst_worker_console
CHANGED
@@ -14,6 +14,10 @@ application_env = arg_pair["env"] || "development"
|
|
14
14
|
raise "Please specify a name for the application E.g. --name=[name]" unless application_name
|
15
15
|
raise "Please specify a family for the application E.g. --family=[family]" unless application_family
|
16
16
|
|
17
|
+
ENV["ENV"] = application_env
|
18
|
+
ENV["WORKER_ENV"] = application_env
|
19
|
+
ENV["RAILS_ENV"] = application_env
|
20
|
+
|
17
21
|
require "irb"
|
18
22
|
require "irb/completion"
|
19
23
|
require_relative "../lib/herdst_worker"
|
@@ -15,7 +15,7 @@ module HerdstWorker
|
|
15
15
|
db_config.each do |k, v|
|
16
16
|
db_config[k] = ActiveRecord::DatabaseConfigurations::HashConfig.new(app.config.env, k, v)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
ActiveRecord::Base.configurations = db_config.values
|
20
20
|
ActiveRecord::Base.establish_connection(db_config[:primary])
|
21
21
|
ActiveRecord::Base.connection.enable_query_cache!
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require "
|
1
|
+
require "stackprof"
|
2
|
+
require "sentry-ruby"
|
2
3
|
|
3
4
|
|
4
5
|
module HerdstWorker
|
@@ -12,12 +13,20 @@ module HerdstWorker
|
|
12
13
|
release = app.config.metadata[:RELEASE_VERSION]
|
13
14
|
sentry_key = app.config.metadata[:SENTRY_KEY]
|
14
15
|
|
15
|
-
|
16
|
-
config.
|
17
|
-
config.
|
18
|
-
config.
|
19
|
-
config.
|
20
|
-
|
16
|
+
::Sentry.init do |config|
|
17
|
+
config.environment = environment
|
18
|
+
config.dsn = sentry_key
|
19
|
+
config.enabled_environments = %w[preview production]
|
20
|
+
config.release = "#{environment}@#{release}"
|
21
|
+
|
22
|
+
# Set traces_sample_rate to 1.0 to capture 100%
|
23
|
+
# of transactions for performance monitoring.
|
24
|
+
# We recommend adjusting this value in production.
|
25
|
+
config.traces_sample_rate = 0.1
|
26
|
+
# Set profiles_sample_rate to profile 100%
|
27
|
+
# of sampled transactions.
|
28
|
+
# We recommend adjusting this value in production.
|
29
|
+
config.profiles_sample_rate = 0.1
|
21
30
|
end
|
22
31
|
rescue Exception => ex
|
23
32
|
app.logger.error ex.message
|
@@ -28,3 +37,39 @@ module HerdstWorker
|
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
# require "sentry-raven"
|
47
|
+
|
48
|
+
|
49
|
+
# module HerdstWorker
|
50
|
+
# module Adapters
|
51
|
+
# class Sentry
|
52
|
+
|
53
|
+
|
54
|
+
# def self.setup(app)
|
55
|
+
# begin
|
56
|
+
# environment = app.config.metadata[:DEPLOYMENT_ENV]
|
57
|
+
# release = app.config.metadata[:RELEASE_VERSION]
|
58
|
+
# sentry_key = app.config.metadata[:SENTRY_KEY]
|
59
|
+
|
60
|
+
# Raven.configure do |config|
|
61
|
+
# config.current_environment = environment
|
62
|
+
# config.release = release
|
63
|
+
# config.dsn = sentry_key if sentry_key
|
64
|
+
# config.environments = ["preview", "production"]
|
65
|
+
# config.async = lambda { |event| Thread.new { Raven.send_event(event) } }
|
66
|
+
# end
|
67
|
+
# rescue Exception => ex
|
68
|
+
# app.logger.error ex.message
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
|
72
|
+
|
73
|
+
# end
|
74
|
+
# end
|
75
|
+
# end
|
@@ -92,7 +92,7 @@ module HerdstWorker
|
|
92
92
|
|
93
93
|
|
94
94
|
def create_email_queue_message(template, company, message_data, attributes = nil, delay = 2)
|
95
|
-
company_key = company.class.name.downcase.to_sym
|
95
|
+
company_key = company.class.name.downcase.to_sym rescue "company"
|
96
96
|
|
97
97
|
# Convert instances of ApplicationRecord to attributes instead of json representation
|
98
98
|
message_data.each do |key, value|
|
@@ -168,7 +168,7 @@ module HerdstWorker
|
|
168
168
|
}.rescue { |ex|
|
169
169
|
if will_fail_permanently
|
170
170
|
self.app.logger.queue.error "Message failed #{attempt_number} times, Reporting and failing permanently. \n#{ex.to_s} \n#{ex.backtrace.join("\n")}"
|
171
|
-
|
171
|
+
Sentry.capture_exception(ex, {
|
172
172
|
:level => "fatal",
|
173
173
|
:extra => {
|
174
174
|
"queue_attempts" => attempt_number,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herdst_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herd.St
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -147,25 +147,39 @@ dependencies:
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '1.80'
|
149
149
|
- !ruby/object:Gem::Dependency
|
150
|
-
name:
|
150
|
+
name: stackprof
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
153
|
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
155
|
+
version: 0.2.7
|
156
|
+
type: :runtime
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 0.2.7
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: sentry-ruby
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '5.17'
|
156
170
|
- - ">="
|
157
171
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
172
|
+
version: 5.17.3
|
159
173
|
type: :runtime
|
160
174
|
prerelease: false
|
161
175
|
version_requirements: !ruby/object:Gem::Requirement
|
162
176
|
requirements:
|
163
177
|
- - "~>"
|
164
178
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
179
|
+
version: '5.17'
|
166
180
|
- - ">="
|
167
181
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
182
|
+
version: 5.17.3
|
169
183
|
- !ruby/object:Gem::Dependency
|
170
184
|
name: rake
|
171
185
|
requirement: !ruby/object:Gem::Requirement
|