|
while totalObjects.count(): |
Here, the code runs as long as the list isn't empty. I had a weird scenario with a database setup where the SQL wasn't generating a DatabaseError, but it wasn't deleting the records either. Since the list was never getting smaller, the code was stuck in an endless loop.
I think it would be better to iterate through the list (instead of reloading the list for each loop) and then at the end print the number of items that still exist in the list.
hue_scripts/lib/custom_commands/management/commands/hue_desktop_document_cleanup.py
Line 62 in 100f70e
Here, the code runs as long as the list isn't empty. I had a weird scenario with a database setup where the SQL wasn't generating a DatabaseError, but it wasn't deleting the records either. Since the list was never getting smaller, the code was stuck in an endless loop.
I think it would be better to iterate through the list (instead of reloading the list for each loop) and then at the end print the number of items that still exist in the list.