Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -18,9 +18,8 @@ import (
|
||||
// - Recomputes derived currencies from anchor tiers and writes to sdprc for all products in mk_price_snapshot.
|
||||
func startProductPricingFxFullScheduler(pgDB *sql.DB) {
|
||||
enabled := strings.TrimSpace(strings.ToLower(os.Getenv("PRODUCT_PRICING_FX_FULL_ENABLED")))
|
||||
// Be conservative: require explicit opt-in.
|
||||
if enabled != "1" && enabled != "true" && enabled != "on" && enabled != "yes" {
|
||||
log.Println("Product pricing FX full scheduler disabled (set PRODUCT_PRICING_FX_FULL_ENABLED=1 to enable)")
|
||||
if enabled == "0" || enabled == "false" || enabled == "off" {
|
||||
log.Println("Product pricing FX full scheduler disabled")
|
||||
return
|
||||
}
|
||||
if pgDB == nil {
|
||||
@@ -48,6 +47,10 @@ func startProductPricingFxFullScheduler(pgDB *sql.DB) {
|
||||
codeBatch = n
|
||||
}
|
||||
}
|
||||
runOnStartup := false
|
||||
if raw := strings.TrimSpace(strings.ToLower(os.Getenv("PRODUCT_PRICING_FX_FULL_RUN_ON_STARTUP"))); raw == "1" || raw == "true" || raw == "on" || raw == "yes" {
|
||||
runOnStartup = true
|
||||
}
|
||||
|
||||
var running int32 = 0
|
||||
|
||||
@@ -133,6 +136,9 @@ LIMIT $2
|
||||
|
||||
go func() {
|
||||
time.Sleep(2 * time.Second)
|
||||
if runOnStartup {
|
||||
runOnce("startup_manual")
|
||||
}
|
||||
for {
|
||||
now := time.Now()
|
||||
n := nextRun(now)
|
||||
|
||||
Reference in New Issue
Block a user