thecore_background_jobs 2.2.1 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thecore_background_jobs.rb +23 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 308eed28d763fd5e8cc373dcb1e4a6c972bdf36f6e5c57a36cbeceb5fa315ed3
|
4
|
+
data.tar.gz: dcd23fcc082b34804513a049ba27f02beae9593f54be6f6ec5951f239624b1fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce274757e53ab219c5f868f1d11469df27610c9f300098276d298872fcdfca28613438da9b9e4f738c20b833e8945da8b565bfd51e5073d3e67c3bed9051505
|
7
|
+
data.tar.gz: b551544d56b8dc68b0cb8f4821dceec36c4b622d5a3cdcafd3eeb40bda3998f28945d4374558fabffbce02b9d9b1c470bdef2ff32a80967d14eb67e496fcd03c
|
@@ -21,39 +21,39 @@ 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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
puts "Setting the schedule from DB value in Setting"
|
24
|
+
begin
|
25
|
+
Sidekiq.get_all_schedules.each_pair do |key, config|
|
26
|
+
Rails.logger.info "Key: #{key}, Config: #{config}"
|
27
|
+
schedule = "cron_for_#{key.underscore}"
|
28
|
+
setting = ThecoreSettings::Setting.where(ns: "schedules", key: schedule).pluck(:raw).first
|
29
|
+
Rails.logger.info "Setting is #{schedule} = #{setting}"
|
30
|
+
# Installing initial sidekiq.yml configuration if setting is not present
|
31
|
+
if setting.blank?
|
32
|
+
Rails.logger.info "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
|
+
Rails.logger.info "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
|
+
Rails.logger.info "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
|
+
Rails.logger.info "Thecore Background Jobs: REDIS not reachable:"
|
46
|
+
Rails.logger.info 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?
|
50
50
|
# begin
|
51
|
-
#
|
51
|
+
# Rails.logger.info "Setting the schedule during initialization"
|
52
52
|
# Sidekiq.set_schedule('check_in_stock_parcels', { cron: check_in_stock_parcels, queue: "#{ENV["COMPOSE_PROJECT_NAME"]}_default", class: 'ScheduleEmployeeReminderForInStockParcelsJob' })
|
53
|
-
#
|
53
|
+
# Rails.logger.info "Reloading schedules during initialization"
|
54
54
|
# SidekiqScheduler::Scheduler.instance.reload_schedule!
|
55
55
|
# rescue => exception
|
56
|
-
#
|
56
|
+
# Rails.logger.info exception.message
|
57
57
|
# end
|
58
58
|
# end
|
59
59
|
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.
|
4
|
+
version: 2.2.3
|
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-
|
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
|