thecore_background_jobs 2.2.1 → 2.2.2

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 -19
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82d56e31e4c201976784d25f1e1c98e3a62c530b9a01b4dfcabd7893330ea637
4
- data.tar.gz: b19cc142777c04aab1182ad8b837ac3135b1177e86107966d580720fbc56bfcc
3
+ metadata.gz: fdcf9fcab7f49e5727cf2d642b3ebe71816f57a56ee584845924309dc52c7b21
4
+ data.tar.gz: 875489c8fe83a696dbd424e91cbefb84f0aed584e8152595c069cf45da4b3675
5
5
  SHA512:
6
- metadata.gz: a87ee9329bb3412c8c3e849fe6ad7ca78abc8a824c2ff315c9ba755a83cbb72bf33803ce0d66ad185e8084922de3d26e3286a4bd641506042398c7813840e933
7
- data.tar.gz: 7ed11c0f63c76547e0a493e23b295c97419e8fe39df06e6f6500735c269981649d823c634c283829fc664c920441fe5510162b0a998d6308f26d7d923b9d01ca
6
+ metadata.gz: 648ba26852bad9f5755dfa938c7fce6bd3540759a42652cdfdb221277ea5ab3090511d79bd6e7135ee333e9d2e243af0a2c3415d0bc9cf0ad94f6b73b3e0f15e
7
+ data.tar.gz: af665f56da46427959900d768bc831088fef8419b1e5ed049640ad9d045402dc9653456e215f03c74da77fa786c8a893532843c8abf39b9da0933f8df0c4b5a1
@@ -21,29 +21,29 @@ module ThecoreBackgroundJobs
21
21
  # "AlertForLongTermStockJob"=>{"cron"=>"0 0 9 * * *", "queue"=>"notset_default", "description"=>"This job Alerts a reference email for items in stock for too long", "enabled"=>true, "class"=>"AlertForLongTermStockJob"},
22
22
  # "ScheduleEmployeeReminderForInStockParcelsJob"=>{"cron"=>"0 0 8,14 * * *", "queue"=>"notset_default", "description"=>"This job checks periodically for new received parcels", "enabled"=>true, "class"=>"ScheduleEmployeeReminderForInStockParcelsJob"}
23
23
  # }
24
- Sidekiq.get_all_schedules.each_pair do |key, config|
25
- puts "Key: #{key}, Config: #{config}"
26
- schedule = "cron_for_#{key.underscore}"
27
- setting = ThecoreSettings::Setting.where(ns: "schedules", key: schedule).pluck(:raw).first
28
- puts "Setting is #{schedule} = #{setting}"
29
- # Installing initial sidekiq.yml configuration if setting is not present
30
- if setting.blank?
31
- puts "Setting #{schedule} doesn't exist, creating based on current value: #{config["cron"]}"
32
- ThecoreSettings::Setting.create(ns: "schedules", key: schedule, raw: config["cron"])
33
- # Settings.ns("schedules").send("#{schedule}=", config["cron"])
34
- elsif config["cron"].squeeze(" ").strip != setting.squeeze(" ").strip
35
- # If we have a setting and is different from the currently loaded, then replace it
36
- # in scheduler configuration
37
- puts "Setting #{schedule} exists: #{setting}"
38
- begin
39
- puts "Setting the schedule from DB value in Setting"
24
+ begin
25
+ Sidekiq.get_all_schedules.each_pair do |key, config|
26
+ puts "Key: #{key}, Config: #{config}"
27
+ schedule = "cron_for_#{key.underscore}"
28
+ setting = ThecoreSettings::Setting.where(ns: "schedules", key: schedule).pluck(:raw).first
29
+ puts "Setting is #{schedule} = #{setting}"
30
+ # Installing initial sidekiq.yml configuration if setting is not present
31
+ if setting.blank?
32
+ puts "Setting #{schedule} doesn't exist, creating based on current value: #{config["cron"]}"
33
+ ThecoreSettings::Setting.create(ns: "schedules", key: schedule, raw: config["cron"])
34
+ # Settings.ns("schedules").send("#{schedule}=", config["cron"])
35
+ elsif config["cron"].squeeze(" ").strip != setting.squeeze(" ").strip
36
+ # If we have a setting and is different from the currently loaded, then replace it
37
+ # in scheduler configuration
38
+ puts "Setting #{schedule} exists: #{setting}"
40
39
  Sidekiq.set_schedule(key.underscore, { cron: setting.squeeze(" ").strip, queue: "#{ENV["COMPOSE_PROJECT_NAME"]}_default", class: key })
41
40
  puts "Reloading schedules"
42
41
  SidekiqScheduler::Scheduler.instance.reload_schedule!
43
- rescue => exception
44
- puts exception.message
45
42
  end
46
- end
43
+ end
44
+ rescue => exception
45
+ puts "Thecore Background Jobs: REDIS not reachable:"
46
+ puts exception.message
47
47
  end
48
48
  # check_in_stock_parcels = ThecoreSettings::Setting.where(ns: "schedules", key: "cron_for_check_in_stock_parcels").pluck(:raw).first
49
49
  # unless check_in_stock_parcels.blank?
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.1
4
+ version: 2.2.2
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-16 00:00:00.000000000 Z
11
+ date: 2022-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_backend_commons