.
This commit is contained in:
+14
-3
@@ -130,7 +130,7 @@ NB_MAX_WORKERS = (
|
||||
|
||||
# Interval en minute minimum entre 2 vérification d'une meme BAL
|
||||
MIN_INTERVAL_MINUTES = 15
|
||||
|
||||
PRIORITY_INTERVAL_MINUTES = 2
|
||||
|
||||
TABLE_BALS = require_env("TABLE_BALS")
|
||||
COL_EMAIL = require_env("COL_EMAIL")
|
||||
@@ -266,7 +266,7 @@ def grist_fetch_new_bals() -> list[dict]:
|
||||
fields = r["fields"]
|
||||
|
||||
# Récupération du timestamp Grist (ex: 1779124323.67)
|
||||
last_pass_timestamp = fields.get("Date_derniere_passe")
|
||||
last_pass_timestamp = fields.get(COL_LAST_PASS)
|
||||
|
||||
# Si le timestamp existe, on valide l'écart de temps
|
||||
if last_pass_timestamp is not None:
|
||||
@@ -314,7 +314,7 @@ def grist_fetch_repass_bals() -> list[dict]:
|
||||
fields = r["fields"]
|
||||
|
||||
# Récupération du timestamp Grist (ex: 1779124323.67)
|
||||
last_pass_timestamp = fields.get("Date_derniere_passe")
|
||||
last_pass_timestamp = fields.get(COL_LAST_PASS)
|
||||
|
||||
# Si le timestamp existe, on valide l'écart de temps
|
||||
if last_pass_timestamp is not None:
|
||||
@@ -372,8 +372,19 @@ def grist_fetch_priority_bals() -> list[dict]:
|
||||
records = resp.json().get("records", [])
|
||||
|
||||
filtered_bals = []
|
||||
current_timestamp = time.time()
|
||||
|
||||
for r in records:
|
||||
fields = r["fields"]
|
||||
last_pass_timestamp = fields.get(COL_LAST_PASS)
|
||||
|
||||
elapsed_time = current_timestamp - float(last_pass_timestamp)
|
||||
if elapsed_time < PRIORITY_INTERVAL_MINUTES * 60:
|
||||
log.debug(
|
||||
f"BAL {r['id']} ignorée : passée il y a seulement {int(elapsed_time // 60)} min."
|
||||
)
|
||||
continue
|
||||
|
||||
filtered_bals.append({"id": r["id"], **fields})
|
||||
return filtered_bals
|
||||
|
||||
|
||||
Reference in New Issue
Block a user