fix some AI bs

This commit is contained in:
cwilvx
2024-10-08 10:49:03 +03:00
parent 6a5cb1488e
commit 99b30b5894
+3 -2
View File
@@ -202,16 +202,17 @@ def get_recently_played(limit=7):
BATCH_SIZE = 200 BATCH_SIZE = 200
current_index = 0 current_index = 0
entries = ScrobbleTable.get_all(0, BATCH_SIZE) entries = ScrobbleTable.get_all(0, BATCH_SIZE)
max_iterations = 20 # Safeguard against unexpected infinite loops max_iterations = 20 # Safeguard against unexpected infinite loops
iterations = 0 iterations = 0
while len(items) < limit and iterations < max_iterations: while len(items) < limit and iterations < max_iterations:
create_items(entries[current_index : current_index + BATCH_SIZE]) create_items(entries)
current_index += BATCH_SIZE current_index += BATCH_SIZE
if len(items) < limit: if len(items) < limit:
entries = ScrobbleTable.get_all(current_index, BATCH_SIZE) entries = ScrobbleTable.get_all(current_index + 1, BATCH_SIZE)
if not entries: if not entries:
break break