fix: Increase train pre-arrival debounce timeout to 5 minutes to prevent multiple broadcasts for fuzzy ETA
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- 1. Configuration & Constants
|
-- 1. Configuration & Constants
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
local APP_VERSION_TEXT = "v1.0.20"
|
local APP_VERSION_TEXT = "v1.0.21"
|
||||||
|
|
||||||
local CONFIG = {
|
local CONFIG = {
|
||||||
CLOUD_URL = "ws://stabadmin.fse-media.group",
|
CLOUD_URL = "ws://stabadmin.fse-media.group",
|
||||||
@@ -2255,8 +2255,9 @@ function Main.loop()
|
|||||||
if etaVal == "1" or etaVal == "现在" then
|
if etaVal == "1" or etaVal == "现在" then
|
||||||
local announceKey = tName .. "_" .. dest
|
local announceKey = tName .. "_" .. dest
|
||||||
local now = os.epoch("utc")
|
local now = os.epoch("utc")
|
||||||
-- Prevent spamming: only announce once per minute per train
|
-- Prevent spamming: CRN's "1 min" can be fuzzy and stay for a while.
|
||||||
if not State.announcedApproaching[announceKey] or (now - State.announcedApproaching[announceKey] > 60000) then
|
-- We increase the cooldown to 5 minutes (300000 ms) per train per destination.
|
||||||
|
if not State.announcedApproaching[announceKey] or (now - State.announcedApproaching[announceKey] > 300000) then
|
||||||
State.announcedApproaching[announceKey] = now
|
State.announcedApproaching[announceKey] = now
|
||||||
Utils.log("INFO", "Train Approaching: " .. tName)
|
Utils.log("INFO", "Train Approaching: " .. tName)
|
||||||
Network.send({
|
Network.send({
|
||||||
|
|||||||
Reference in New Issue
Block a user