gouda 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -9
- data/lib/gouda/version.rb +1 -1
- data/lib/gouda/workload.rb +1 -1
- data/lib/gouda.rb +25 -15
- data/test/gouda/test_helper.rb +1 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 194787c234288ffdeede62d80c4b4bb2fc32f9fc14dff756176ce1962ebacd99
|
4
|
+
data.tar.gz: 2c02e284e17e80640c279057c66afcbd34d40ccac3ab730a59572c21562c0430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52ded3cb575eedb5392d51cfe9a358d4a76792a65c3764bbf7ad091c5d17740cfdb7429278a8389abb15533ff97298810e954595c5d7621044e7d6bf2e728f60
|
7
|
+
data.tar.gz: 4df3f4ab5d53ef0acbf4c9be87500e6c64e2333444035de113337822894b7ab414b68970a6f6c4194c65a1042ab4f4f86276aec7b4ab48ea1a46b1c8ad67c56f
|
data/CHANGELOG.md
CHANGED
@@ -1,42 +1,50 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1.0] -
|
3
|
+
## [0.1.0] - 2024-06-10
|
4
4
|
|
5
5
|
- Initial release
|
6
6
|
|
7
|
-
## [0.1.1] -
|
7
|
+
## [0.1.1] - 2024-06-10
|
8
8
|
|
9
9
|
- Fix support for older ruby versions until 2.7
|
10
10
|
|
11
|
-
## [0.1.2] -
|
11
|
+
## [0.1.2] - 2024-06-11
|
12
12
|
|
13
13
|
- Updated readme and method renaming in Scheduler
|
14
14
|
|
15
|
-
## [0.1.3] -
|
15
|
+
## [0.1.3] - 2024-06-11
|
16
16
|
|
17
17
|
- Allow the Rails app to boot even if there is no database yet
|
18
18
|
|
19
|
-
## [0.1.4] -
|
19
|
+
## [0.1.4] - 2024-06-14
|
20
20
|
|
21
21
|
- Rescue NoDatabaseError at scheduler update.
|
22
22
|
- Include tests in gem, for sake of easier debugging.
|
23
23
|
- Reduce logging in local test runs.
|
24
24
|
- Bump local ruby version to 3.3.3
|
25
25
|
|
26
|
-
## [0.1.5] -
|
26
|
+
## [0.1.5] - 2024-06-18
|
27
27
|
|
28
28
|
- Update documentation
|
29
29
|
- Don't pass on scheduler keys to retries
|
30
30
|
|
31
|
-
## [0.1.6] -
|
31
|
+
## [0.1.6] - 2024-06-18
|
32
32
|
|
33
33
|
- Fix: don't upsert workloads twice when starting Gouda.
|
34
34
|
- Add back in Appsignal calls
|
35
35
|
|
36
|
-
## [0.1.7] -
|
36
|
+
## [0.1.7] - 2024-06-21
|
37
37
|
|
38
38
|
- Separate all instrumentation to use ActiveSupport::Notification
|
39
39
|
|
40
|
-
## [0.1.8] -
|
40
|
+
## [0.1.8] - 2024-06-21
|
41
41
|
|
42
42
|
- Move some missed instrumentations to Gouda.instrument
|
43
|
+
|
44
|
+
## [0.1.9] - 2024-06-26
|
45
|
+
|
46
|
+
- Fix: cleanup_preserved_jobs_before in Gouda::Workload.prune now points to Gouda.config
|
47
|
+
|
48
|
+
## [0.1.10] - 2024-07-03
|
49
|
+
|
50
|
+
- Fix: remove logger overrides that Gouda should install, as this causes problems for Rails apps hosting Gouda
|
data/lib/gouda/version.rb
CHANGED
data/lib/gouda/workload.rb
CHANGED
@@ -45,7 +45,7 @@ class Gouda::Workload < ActiveRecord::Base
|
|
45
45
|
|
46
46
|
def self.prune
|
47
47
|
if Gouda.config.preserve_job_records
|
48
|
-
where(state: "finished").where("execution_finished_at < ?", Gouda.cleanup_preserved_jobs_before.ago).delete_all
|
48
|
+
where(state: "finished").where("execution_finished_at < ?", Gouda.config.cleanup_preserved_jobs_before.ago).delete_all
|
49
49
|
else
|
50
50
|
where(state: "finished").delete_all
|
51
51
|
end
|
data/lib/gouda.rb
CHANGED
@@ -24,19 +24,14 @@ module Gouda
|
|
24
24
|
config_accessor(:cleanup_preserved_jobs_before, default: 3.hours)
|
25
25
|
config_accessor(:polling_sleep_interval_seconds, default: 0.2)
|
26
26
|
config_accessor(:worker_thread_count, default: 1)
|
27
|
-
config_accessor(:logger, default: ActiveSupport::Logger.new($stdout))
|
28
27
|
config_accessor(:app_executor)
|
29
28
|
config_accessor(:cron, default: {})
|
30
29
|
config_accessor(:enable_cron, default: true)
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
# Logger::ERROR (3)
|
37
|
-
# Logger::FATAL (4)
|
38
|
-
# Logger::UNKNOWN (5)
|
39
|
-
config_accessor(:log_level, default: Logger::DEBUG)
|
30
|
+
# Deprecated logger configuration. This needs to be available in the
|
31
|
+
# Configuration object because it might be used from the Rails app
|
32
|
+
# that is using Gouda. The config values will be ignored though.
|
33
|
+
config_accessor(:logger, default: nil)
|
34
|
+
config_accessor(:log_level, default: nil)
|
40
35
|
end
|
41
36
|
|
42
37
|
class InterruptError < StandardError
|
@@ -52,10 +47,10 @@ module Gouda
|
|
52
47
|
Gouda::AnyQueue
|
53
48
|
end
|
54
49
|
|
55
|
-
|
56
|
-
|
50
|
+
logger.info("Gouda version: #{Gouda::VERSION}")
|
51
|
+
logger.info("Worker threads: #{Gouda.config.worker_thread_count}")
|
57
52
|
|
58
|
-
|
53
|
+
worker_loop(n_threads: Gouda.config.worker_thread_count, queue_constraint: queue_constraint)
|
59
54
|
end
|
60
55
|
|
61
56
|
def self.config
|
@@ -67,14 +62,29 @@ module Gouda
|
|
67
62
|
end
|
68
63
|
|
69
64
|
def self.logger
|
70
|
-
|
65
|
+
# By default, return a logger that sends data nowhere. The `Rails.logger` method
|
66
|
+
# only becomes available later in the Rails lifecycle.
|
67
|
+
@fallback_gouda_logger ||= begin
|
68
|
+
ActiveSupport::Logger.new($stdout).tap do |logger|
|
69
|
+
logger.level = Logger::WARN
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# We want the Rails-configured loggers to take precedence over ours, since Gouda
|
74
|
+
# is just an ActiveJob adapter and the Workload is just an ActiveRecord, in the end.
|
75
|
+
# So it should be up to the developer of the app, not to us, to set the logger up
|
76
|
+
# and configure out. There are also gems such as "stackdriver" from Google which
|
77
|
+
# rather unceremonously overwrite the Rails logger with their own. If that happens,
|
78
|
+
# it is the choice of the user to do so - and we should honor that choice. Same for
|
79
|
+
# the logging level - the Rails logger level must take precendence. Same for logger
|
80
|
+
# broadcasts which get set up, for example, by the Rails console when you start it.
|
81
|
+
Rails.try(:logger) || ActiveJob::Base.try(:logger) || @fallback_gouda_logger
|
71
82
|
end
|
72
83
|
|
73
84
|
def self.instrument(channel, options, &block)
|
74
85
|
ActiveSupport::Notifications.instrument("#{channel}.gouda", options, &block)
|
75
86
|
end
|
76
87
|
|
77
|
-
|
78
88
|
def self.create_tables(active_record_schema)
|
79
89
|
active_record_schema.create_enum :gouda_workload_state, %w[enqueued executing finished]
|
80
90
|
active_record_schema.create_table :gouda_workloads, id: :uuid do |t|
|
data/test/gouda/test_helper.rb
CHANGED
@@ -23,8 +23,7 @@ class ActiveSupport::TestCase
|
|
23
23
|
@adapter || Gouda::Adapter.new
|
24
24
|
@case_random = Random.new(Minitest.seed)
|
25
25
|
Gouda::Railtie.initializers.each(&:run)
|
26
|
-
|
27
|
-
Gouda.config.logger.level = 4
|
26
|
+
Gouda.logger.level = Logger::WARN
|
28
27
|
end
|
29
28
|
|
30
29
|
teardown do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gouda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian van Hesteren
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.5.
|
191
|
+
rubygems_version: 3.5.11
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: Job Scheduler
|