gouda 0.1.9 → 0.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '068482a6e09e7964085e1640542cff5ce00a8c536c20b1225f21e998b5ea1d26'
4
- data.tar.gz: 279759ccb7b9f19c4563839ba6c21f1b2fb1366e066e3534ce85d2220facfc07
3
+ metadata.gz: 194787c234288ffdeede62d80c4b4bb2fc32f9fc14dff756176ce1962ebacd99
4
+ data.tar.gz: 2c02e284e17e80640c279057c66afcbd34d40ccac3ab730a59572c21562c0430
5
5
  SHA512:
6
- metadata.gz: 6c88fea153e08fa57f0a63cc72e3cc708d83eb5a67fb06d99587fba07d56ced9082ceecf2892e59872d1c8d09e0ee0a3b0e0bb462768270cdb799b8dc998ab9a
7
- data.tar.gz: c1fd707147f85b7a9769fb1889015299e881ebb94cd79317207fcb24512e0e72b64bf303c2eb69a5079be1035087f37dbe045166791adf805daa10a90a73ecf9
6
+ metadata.gz: 52ded3cb575eedb5392d51cfe9a358d4a76792a65c3764bbf7ad091c5d17740cfdb7429278a8389abb15533ff97298810e954595c5d7621044e7d6bf2e728f60
7
+ data.tar.gz: 4df3f4ab5d53ef0acbf4c9be87500e6c64e2333444035de113337822894b7ab414b68970a6f6c4194c65a1042ab4f4f86276aec7b4ab48ea1a46b1c8ad67c56f
data/CHANGELOG.md CHANGED
@@ -1,46 +1,50 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2023-06-10
3
+ ## [0.1.0] - 2024-06-10
4
4
 
5
5
  - Initial release
6
6
 
7
- ## [0.1.1] - 2023-06-10
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] - 2023-06-11
11
+ ## [0.1.2] - 2024-06-11
12
12
 
13
13
  - Updated readme and method renaming in Scheduler
14
14
 
15
- ## [0.1.3] - 2023-06-11
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] - 2023-06-14
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] - 2023-06-18
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] - 2023-06-18
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] - 2023-06-21
36
+ ## [0.1.7] - 2024-06-21
37
37
 
38
38
  - Separate all instrumentation to use ActiveSupport::Notification
39
39
 
40
- ## [0.1.8] - 2023-06-21
40
+ ## [0.1.8] - 2024-06-21
41
41
 
42
42
  - Move some missed instrumentations to Gouda.instrument
43
43
 
44
- ## [0.1.9] - 2023-06-26
44
+ ## [0.1.9] - 2024-06-26
45
45
 
46
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gouda
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.10"
5
5
  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
- # Log levels are:
32
- # constant | level
33
- # Logger::DEBUG (0)
34
- # Logger::INFO (1)
35
- # Logger::WARN (2)
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
- Gouda.logger.info("Gouda version: #{Gouda::VERSION}")
56
- Gouda.logger.info("Worker threads: #{Gouda.config.worker_thread_count}")
50
+ logger.info("Gouda version: #{Gouda::VERSION}")
51
+ logger.info("Worker threads: #{Gouda.config.worker_thread_count}")
57
52
 
58
- Gouda.worker_loop(n_threads: Gouda.config.worker_thread_count, queue_constraint: queue_constraint)
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
- Gouda.config.logger
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|
@@ -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
- ActiveJob::Base.logger = nil
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.9
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-06-26 00:00:00.000000000 Z
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.13
191
+ rubygems_version: 3.5.11
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Job Scheduler