Bjo53 commited on
Commit
c46ffe9
·
verified ·
1 Parent(s): c4a81ed

Upload keepalive.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. keepalive.py +4 -5
keepalive.py CHANGED
@@ -22,21 +22,20 @@ def human_ping():
22
  except Exception as e:
23
  print(f'[HumanPing] Error: {e}')
24
 
25
- # Random interval between 2-4 minutes (like a real human)
26
- wait = random.randint(120, 240)
 
27
  time.sleep(wait)
28
 
29
  def activity_check():
30
  while True:
31
  try:
32
- # Simulate user activity
33
  os.system('date > /tmp/last_activity')
34
  os.system('whoami > /dev/null')
35
  except:
36
  pass
37
- time.sleep(300)
38
 
39
- # Start threads
40
  threading.Thread(target=human_ping, daemon=True).start()
41
  threading.Thread(target=activity_check, daemon=True).start()
42
 
 
22
  except Exception as e:
23
  print(f'[HumanPing] Error: {e}')
24
 
25
+ # Truly random interval: 15-90 minutes (no pattern)
26
+ wait = random.randint(900, 5400)
27
+ print(f'[HumanPing] Next ping in {wait//60}m {wait%60}s')
28
  time.sleep(wait)
29
 
30
  def activity_check():
31
  while True:
32
  try:
 
33
  os.system('date > /tmp/last_activity')
34
  os.system('whoami > /dev/null')
35
  except:
36
  pass
37
+ time.sleep(random.randint(300, 600))
38
 
 
39
  threading.Thread(target=human_ping, daemon=True).start()
40
  threading.Thread(target=activity_check, daemon=True).start()
41