def handle(self, *args, **options):
<EOL>last_id = Submission._objects.all().aggregate(Max('<STR_LIT:id>'))['<STR_LIT>']<EOL>log.info("<STR_LIT>")<EOL>current = options['<STR_LIT:start>']<EOL>while current < last_id:<EOL><INDENT>end_chunk = current + options['<STR_LIT>'] if last_id - options['<STR_LIT>'] >= current else last_id<EOL>log.info("<STR_LIT>".format(current, end_chunk))<EOL>with transaction.atomic():<EOL><INDENT>for submission in Submission._objects.filter(id__gte=current, id__lte=end_chunk).iterator():<EOL><INDENT>submission.save(update_fields=['<STR_LIT>'])<EOL><DEDENT><DEDENT>time.sleep(options['<STR_LIT>'])<EOL>current = end_chunk + <NUM_LIT:1><EOL><DEDENT>
By default, we're going to do this in chunks. This way, if there ends up being an error,
we can check log messages and continue from that point after fixing the issue.