mirror of
https://github.com/MCMi460/3DS-RPC.git
synced 2025-06-18 21:45:37 -04:00
rpc: Do not repeat within additional while loop
We additionally add a delay at the end of the loop to prevent accidental spam.
This commit is contained in:
parent
45c52a9cbf
commit
5755a272de
@ -230,7 +230,9 @@ while True:
|
||||
)
|
||||
inactive_users = session.scalars(inactive_query).all()
|
||||
|
||||
print('[CLEARING INACTIVES; BATCH OF %s]' % len(inactive_users))
|
||||
if len(inactive_users) > 0:
|
||||
print('[INACTIVES; BATCH OF %s]' % len(inactive_users))
|
||||
|
||||
for inactive_user in inactive_users:
|
||||
api_client = APIClient(inactive_user)
|
||||
try:
|
||||
@ -243,11 +245,8 @@ while True:
|
||||
time.sleep(delay)
|
||||
|
||||
# Finally, we'll refresh presences for all remaining users.
|
||||
wait = time.time()
|
||||
while time.time() - wait <= 1200:
|
||||
discord_friends = session.scalars(select(DiscordFriends).where(DiscordFriends.active)).all()
|
||||
|
||||
print('[BATCH OF %s USERS]' % len(discord_friends))
|
||||
if len(discord_friends) < 1:
|
||||
time.sleep(delay)
|
||||
continue
|
||||
@ -309,3 +308,6 @@ while True:
|
||||
except HTTPError:
|
||||
api_client.delete_discord_user()
|
||||
time.sleep(delay)
|
||||
|
||||
# Sleep for 5x our delay.
|
||||
time.sleep(delay * 5)
|
||||
|
Loading…
Reference in New Issue
Block a user