Skip to content

Commit a2aaaea

Browse files
Merge pull request #35 from Purple-Stock/staging
Staging
2 parents c9fd705 + 69233ab commit a2aaaea

File tree

2 files changed

+95
-9
lines changed

2 files changed

+95
-9
lines changed

config/database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ staging:
100100
database: inventory-control_staging
101101
username: inventory-control
102102
password: <%= ENV['INVENTORY-CONTROL_DATABASE_PASSWORD'] %>
103-
pool: <%= 1 + 2 + ENV.fetch("GOOD_JOB_MAX_THREADS", 5).to_i %>
103+
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 20).to_i + 1 + 2 + ENV.fetch("GOOD_JOB_MAX_THREADS", 20).to_i %>

config/environments/staging.rb

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,102 @@
9696
# Do not dump schema after migrations.
9797
config.active_record.dump_schema_after_migration = false
9898

99-
config.good_job.enable_cron = true
99+
config.good_job.enable_cron = false
100100
config.good_job.cron = {
101-
# Every 15 minutes, enqueue `ExampleJob.set(priority: -10).perform_later(42, "life", name: "Alice")`
102-
frequent_task: { # each recurring job must have a unique key
103-
cron: "*/1 * * * *", # cron-style scheduling format by fugit gem
104-
class: "BlingOrderItemCreatorJob", # name of the job class as a String; must reference an Active Job job class
105-
args: [1], # positional arguments to pass to the job; can also be a proc e.g. `-> { [Time.now] }`
106-
set: { priority: -10 }, # additional Active Job properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
107-
description: "Create Order Items per situation", # optional description that appears in Dashboard
101+
product_sync_job: {
102+
cron: "*/10 * * * *",
103+
class: "ProductSyncJob",
104+
args: [1],
105+
set: { priority: 1 },
106+
description: "Synchronize products"
108107
},
108+
109+
in_progress_order_items_task: { # each recurring job must have a unique key
110+
cron: "*/2 * * * *", # cron-style scheduling format by fugit gem
111+
class: "InProgressOrderItemsJob", # name of the job class as a String; must reference an Active Job job class
112+
args: [1], # positional arguments to pass to the job; can also be a proc e.g. `-> { [Time.now] }`
113+
set: { priority: 1 }, # additional Active Job properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
114+
description: "Create Order Items with status in progress" # optional description that appears in Dashboard
115+
},
116+
117+
weekly_pending_order_items_task: {
118+
cron: "*/4 * * * *",
119+
class: "PendingOrderItemsJob",
120+
args: [1, { dataInicial: (Date.today - 3.weeks).strftime, dataFinal: Date.today.strftime }],
121+
set: { priority: 1 },
122+
description: "Create Order Items with pending status from current week"
123+
},
124+
125+
general_pending_order_items_task: {
126+
cron: "@monthly",
127+
class: "PendingOrderItemsJob",
128+
args: [1],
129+
set: { priority: 1 },
130+
description: "Create Order Items with pending status considering all period"
131+
},
132+
133+
printed_order_items_task: { # each recurring job must have a unique key
134+
cron: "*/2 * * * *", # cron-style scheduling format by fugit gem
135+
class: "PrintedOrderItemsJob", # name of the job class as a String; must reference an Active Job job class
136+
args: [1], # positional arguments to pass to the job; can also be a proc e.g. `-> { [Time.now] }`
137+
set: { priority: 1 }, # additional Active Job properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
138+
description: "Create Order Items with printed status" # optional description that appears in Dashboard
139+
},
140+
141+
current_done_order_items_task: { # each recurring job must have a unique key
142+
cron: "*/2 * * * *", # cron-style scheduling format by fugit gem
143+
class: "CurrentDoneBlingOrderItemJob", # name of the job class as a String; must reference an Active Job job class
144+
args: [1], # positional arguments to pass to the job; can also be a proc e.g. `-> { [Time.now] }`
145+
set: { priority: 1 }, # additional Active Job properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
146+
description: "Create Order Items statuses are checked and verified" # optional description that appears in Dashboard
147+
},
148+
general_canceled_order_items_task: { # each recurring job must have a unique key
149+
cron: "@monthly", # cron-style scheduling format by fugit gem
150+
class: "CanceledBlingOrderItemsJob", # name of the job class as a String; must reference an Active Job job class
151+
args: [1], # positional arguments to pass to the job; can also be a proc e.g. `-> { [Time.now] }`
152+
set: { priority: 1 }, # additional Active Job properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
153+
description: "Create Order Items statuses are canceled" # optional description that appears in Dashboard
154+
},
155+
156+
weekly_canceled_order_items_task: { # each recurring job must have a unique key
157+
cron: "*/4 * * * *", # cron-style scheduling format by fugit gem
158+
class: "WeeklyCanceledOrderItemsJob", # name of the job class as a String; must reference an Active Job job class
159+
args: [1, { dataInicial: 3.weeks.ago.to_date.strftime, dataFinal: Date.today.strftime }], # positional arguments to pass to the job; can also be a proc e.g. `-> { [Time.now] }`
160+
set: { priority: 1 }, # additional Active Job properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
161+
description: "Create Order Items statuses are canceled" # optional description that appears in Dashboard
162+
},
163+
164+
daily_canceled_order_task: {
165+
cron: "*/10 * * * *",
166+
class: "DailyCanceledOrderJob",
167+
args: [1, Date.today],
168+
set: { priority: 1 },
169+
description: "Create Order Items statuses are canceled at current day"
170+
},
171+
172+
checked_order_items_task: {
173+
cron: "@weekly",
174+
class: "CheckedBlingOrderItemsJob",
175+
args: [1],
176+
set: { priority: 3 },
177+
description: "Create Order Items statuses are checked"
178+
},
179+
180+
frequent_checked_order_items_task: {
181+
cron: "*/2 * * * *",
182+
class: "CheckedBlingOrderItemsJob",
183+
args: [1, (Date.today - 5.days)],
184+
set: { priority: 1 },
185+
description: "Create Order Items statuses are checked"
186+
},
187+
188+
verified_order_items_task: {
189+
cron: "@weekly",
190+
class: "VerifiedBlingOrderItemsJob",
191+
args: [1],
192+
set: { priority: 4 },
193+
description: "Create Order Items whose statuses are verified"
194+
}
109195
# etc.
110196
}
111197
end

0 commit comments

Comments
 (0)