gouda 0.1.9 → 0.1.11

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
  SHA256:
3
- metadata.gz: '068482a6e09e7964085e1640542cff5ce00a8c536c20b1225f21e998b5ea1d26'
4
- data.tar.gz: 279759ccb7b9f19c4563839ba6c21f1b2fb1366e066e3534ce85d2220facfc07
3
+ metadata.gz: 9b4b5340ec99f15fe7a62bc9a63642862219dc149d38d2e7e519f2ed655747e0
4
+ data.tar.gz: 817fe1a0ef4a2b107ad07ce28c3e627e79ffe3cf5fb1be06089165e07e432ec5
5
5
  SHA512:
6
- metadata.gz: 6c88fea153e08fa57f0a63cc72e3cc708d83eb5a67fb06d99587fba07d56ced9082ceecf2892e59872d1c8d09e0ee0a3b0e0bb462768270cdb799b8dc998ab9a
7
- data.tar.gz: c1fd707147f85b7a9769fb1889015299e881ebb94cd79317207fcb24512e0e72b64bf303c2eb69a5079be1035087f37dbe045166791adf805daa10a90a73ecf9
6
+ metadata.gz: 0aa57b5dedc0a7fe3126d965fe377ebb00dc8f407d7a01877886b57c2f35f45bd2c254d370949a65ec44f3704353b2741509ff099acc0c285aa752ab500805a1
7
+ data.tar.gz: 29f6d58da6179f0af817c541fdf9e0ca2fbf00fa83cab2d69c780a221761b26d08679a02419afbba93070d7d19babed436727a2cf994471fa94aabf7c359a7b8
data/CHANGELOG.md CHANGED
@@ -1,46 +1,54 @@
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
51
+
52
+ ## [0.1.11] - 2024-07-03
53
+
54
+ - Fix: make sure the Gouda logger config does not get used during Rails initialization
data/lib/gouda/railtie.rb CHANGED
@@ -43,14 +43,10 @@ module Gouda
43
43
  Gouda.config.preserve_job_records = config_from_rails[:preserve_job_records]
44
44
  Gouda.config.polling_sleep_interval_seconds = config_from_rails[:polling_sleep_interval_seconds]
45
45
  Gouda.config.worker_thread_count = config_from_rails[:worker_thread_count]
46
- if Gouda.config.logger
47
- Gouda.config.logger.level = config_from_rails[:log_level] || Gouda.config.log_level
48
- end
49
46
  end
50
47
  else
51
48
  Gouda.config.preserve_job_records = false
52
49
  Gouda.config.polling_sleep_interval_seconds = 0.2
53
- Gouda.config.logger.level = Gouda.config.log_level
54
50
  end
55
51
 
56
52
  Gouda::Scheduler.build_scheduler_entries_list!
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.11"
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.11
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