DinoPLayZ commited on
Commit
7780cc1
·
verified ·
1 Parent(s): b9d1416

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -13
main.py CHANGED
@@ -314,7 +314,7 @@ def check_new_events(last_id, xsrf_token, bip_session):
314
  # SCHEDULER ENGINE
315
  # ==============================================================================
316
  def process_tick():
317
- global LAST_EVENT_ID, LAST_EVENT_CODE, SESSION_EXPIRED
318
  logger.debug("--- process_tick starting ---")
319
 
320
  # Reload environment variables on every tick
@@ -323,16 +323,9 @@ def process_tick():
323
  bip = os.getenv("BIP_SESSION", "")
324
 
325
  if not xsrf or not bip:
326
- logger.warning("Skipping check: Please configure XSRF_TOKEN and BIP_SESSION in the .env file.")
327
- return
328
-
329
- if SESSION_EXPIRED:
330
- if xsrf == EXPIRED_XSRF and bip == EXPIRED_BIP:
331
- logger.info("Paused: Waiting for new cookies in .env to resume...")
332
- return
333
- else:
334
- logger.info("New cookies detected! Resuming checks...")
335
- SESSION_EXPIRED = False
336
 
337
  # Task 1: Load state if we just started
338
  if LAST_EVENT_ID is None:
@@ -350,8 +343,9 @@ def process_tick():
350
  "Please update the `XSRF_TOKEN` and `BIP_SESSION` variables in your Secret/Env configuration and restart the Space.",
351
  is_html=True
352
  )
353
- SESSION_EXPIRED = True
354
- return
 
355
 
356
  if new_events:
357
  # If LAST_EVENT_ID is None, it's the very first startup run. Set ID without alerting.
 
314
  # SCHEDULER ENGINE
315
  # ==============================================================================
316
  def process_tick():
317
+ global LAST_EVENT_ID, LAST_EVENT_CODE, SESSION_EXPIRED, EXPIRED_XSRF, EXPIRED_BIP
318
  logger.debug("--- process_tick starting ---")
319
 
320
  # Reload environment variables on every tick
 
323
  bip = os.getenv("BIP_SESSION", "")
324
 
325
  if not xsrf or not bip:
326
+ logger.warning("Skipping check: Please configure XSRF_TOKEN and BIP_SESSION in the deployment environment.")
327
+ import os
328
+ os._exit(1)
 
 
 
 
 
 
 
329
 
330
  # Task 1: Load state if we just started
331
  if LAST_EVENT_ID is None:
 
343
  "Please update the `XSRF_TOKEN` and `BIP_SESSION` variables in your Secret/Env configuration and restart the Space.",
344
  is_html=True
345
  )
346
+ logger.error("Notifier is shutting down completely because of the scraping error.")
347
+ import os
348
+ os._exit(1)
349
 
350
  if new_events:
351
  # If LAST_EVENT_ID is None, it's the very first startup run. Set ID without alerting.