thecore_background_jobs 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/thecore_background_jobs.rb +19 -16
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 308eed28d763fd5e8cc373dcb1e4a6c972bdf36f6e5c57a36cbeceb5fa315ed3
4
- data.tar.gz: dcd23fcc082b34804513a049ba27f02beae9593f54be6f6ec5951f239624b1fd
3
+ metadata.gz: fd7c37d9c19471417017d79ffd5b8a02dcb594fb2c8e6103958b58093fde23d9
4
+ data.tar.gz: ac87a1589246976f3a4792f7063fd5dc8a4cfe314541654ec86bfcf1fcd6bc41
5
5
  SHA512:
6
- metadata.gz: 9ce274757e53ab219c5f868f1d11469df27610c9f300098276d298872fcdfca28613438da9b9e4f738c20b833e8945da8b565bfd51e5073d3e67c3bed9051505
7
- data.tar.gz: b551544d56b8dc68b0cb8f4821dceec36c4b622d5a3cdcafd3eeb40bda3998f28945d4374558fabffbce02b9d9b1c470bdef2ff32a80967d14eb67e496fcd03c
6
+ metadata.gz: 3cc5197dfcf9092baecc0264821130e9ff00d9245b5f2a9258f7924f39db5bcc003b561ed54e5d5ac5d8cef162c1b43d7ea1d7b59f5aa90d6e1a48db587448fb
7
+ data.tar.gz: 2cb70b6be9a466d0400e73f677f267a0d5f584e8c0ef72517e63e6a97e2ca07d38dc8394cb0a776eb707251ad532f6a16d073b6750ede6068ede110c2ae4768d
@@ -8,11 +8,25 @@ require "thecore_background_jobs/engine"
8
8
  module ThecoreBackgroundJobs
9
9
  # Your code goes here...
10
10
  def self.email_setup
11
- delivery_options = { domain: Settings.ns(:smtp).domain, address: Settings.ns(:smtp).address, port: Settings.ns(:smtp).port.to_i, enable_starttls_auto: (Settings.ns(:smtp).enable_starttls_auto == "true")}
11
+ # Fill variables with the correct values
12
+ domain = ThecoreSettings::Setting.where(ns: :smtp, key: :domain).first.raw
13
+ address = ThecoreSettings::Setting.where(ns: :smtp, key: :address).first.raw
14
+ port = ThecoreSettings::Setting.where(ns: :smtp, key: :port).first.raw.to_i
15
+ enable_starttls_auto = ThecoreSettings::Setting.where(ns: :smtp, key: :enable_starttls_auto).first.raw == "true"
16
+ user_name = ThecoreSettings::Setting.where(ns: :smtp, key: :user_name).first.raw
17
+ password = ThecoreSettings::Setting.where(ns: :smtp, key: :password).first.raw
18
+ authentication = ThecoreSettings::Setting.where(ns: :smtp, key: :authentication).first.raw
19
+
20
+ delivery_options = {
21
+ domain: domain,
22
+ address: address,
23
+ port: port,
24
+ enable_starttls_auto: enable_starttls_auto
25
+ }
12
26
  # Other Options
13
- delivery_options.merge!({user_name: Settings.ns(:smtp).user_name}) unless Settings.ns(:smtp).user_name.blank?
14
- delivery_options.merge!({password: Settings.ns(:smtp).password}) unless Settings.ns(:smtp).password.blank?
15
- delivery_options.merge!({authentication: Settings.ns(:smtp).authentication}) unless Settings.ns(:smtp).authentication.blank?
27
+ delivery_options.merge!({user_name: user_name}) unless user_name.blank?
28
+ delivery_options.merge!({password: password}) unless password.blank?
29
+ delivery_options.merge!({authentication: authentication}) unless authentication.blank? || authentication == "none"
16
30
  delivery_options
17
31
  end
18
32
 
@@ -36,7 +50,7 @@ module ThecoreBackgroundJobs
36
50
  # If we have a setting and is different from the currently loaded, then replace it
37
51
  # in scheduler configuration
38
52
  Rails.logger.info "Setting #{schedule} exists: #{setting}"
39
- Sidekiq.set_schedule(key.underscore, { cron: setting.squeeze(" ").strip, queue: "#{ENV["COMPOSE_PROJECT_NAME"]}_default", class: key })
53
+ Sidekiq.set_schedule(key, { cron: setting.squeeze(" ").strip, queue: "#{ENV["COMPOSE_PROJECT_NAME"]}_default", class: key })
40
54
  Rails.logger.info "Reloading schedules"
41
55
  SidekiqScheduler::Scheduler.instance.reload_schedule!
42
56
  end
@@ -45,16 +59,5 @@ module ThecoreBackgroundJobs
45
59
  Rails.logger.info "Thecore Background Jobs: REDIS not reachable:"
46
60
  Rails.logger.info exception.message
47
61
  end
48
- # check_in_stock_parcels = ThecoreSettings::Setting.where(ns: "schedules", key: "cron_for_check_in_stock_parcels").pluck(:raw).first
49
- # unless check_in_stock_parcels.blank?
50
- # begin
51
- # Rails.logger.info "Setting the schedule during initialization"
52
- # Sidekiq.set_schedule('check_in_stock_parcels', { cron: check_in_stock_parcels, queue: "#{ENV["COMPOSE_PROJECT_NAME"]}_default", class: 'ScheduleEmployeeReminderForInStockParcelsJob' })
53
- # Rails.logger.info "Reloading schedules during initialization"
54
- # SidekiqScheduler::Scheduler.instance.reload_schedule!
55
- # rescue => exception
56
- # Rails.logger.info exception.message
57
- # end
58
- # end
59
62
  end
60
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_background_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-19 00:00:00.000000000 Z
11
+ date: 2024-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_backend_commons
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.0.3.1
122
+ rubygems_version: 3.1.6
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Thecorized thecore_background_jobs