DevangMahesh commited on
Commit
43e16dd
·
1 Parent(s): b5f9809

Cleanup working. Restoring original time out values

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -66,7 +66,7 @@ def reset_hope_client(exit_fn=None):
66
  #If More than an hour to last access to HOPE
67
  try:
68
  while True:
69
- time.sleep(120)
70
  with Lock:
71
  if hope_client and TIMESTAMP_LAST_CALL_TO_HOPE and time.time() - TIMESTAMP_LAST_CALL_TO_HOPE > 3600:
72
  logger.info("Closing Hope Client Connection. An hour since the last iteraction.")
@@ -77,7 +77,8 @@ def reset_hope_client(exit_fn=None):
77
  logger.debug("Cleaning Ongoing convo")
78
  for sender_id in ONGOING_CONVO.keys():
79
  logger.debug(f"Trying to clean up sender {sender_id}")
80
- if( ONGOING_CONVO[sender_id] and (time.time() - ONGOING_CONVO[sender_id].get("lst_msg_time", 0) > 60)):
 
81
  clean_up_audio_files(sender_id)
82
  ONGOING_CONVO[sender_id] = None
83
  finally:
 
66
  #If More than an hour to last access to HOPE
67
  try:
68
  while True:
69
+ time.sleep(3600)
70
  with Lock:
71
  if hope_client and TIMESTAMP_LAST_CALL_TO_HOPE and time.time() - TIMESTAMP_LAST_CALL_TO_HOPE > 3600:
72
  logger.info("Closing Hope Client Connection. An hour since the last iteraction.")
 
77
  logger.debug("Cleaning Ongoing convo")
78
  for sender_id in ONGOING_CONVO.keys():
79
  logger.debug(f"Trying to clean up sender {sender_id}")
80
+ if( ONGOING_CONVO[sender_id] and (time.time() - ONGOING_CONVO[sender_id].get("lst_msg_time", 0) > 2400)):
81
+ send_whatsapp_message(sender_id, None, "Session Time-Out", text=True)
82
  clean_up_audio_files(sender_id)
83
  ONGOING_CONVO[sender_id] = None
84
  finally: