bulk_update: Do updates in bulk where applicable.

This commit is contained in:
Clara Dantas
2020-08-03 14:55:57 -03:00
committed by Tim Abbott
parent f9cbefac41
commit f26d0affef
2 changed files with 4 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ Usage: ./manage.py deliver_scheduled_messages
with transaction.atomic():
do_send_messages([self.construct_message(message)])
message.delivered = True
message.save(update_fields=['delivered'])
Message.objects.bulk_update(messages_to_deliver, ['delivered'])
cur_time = timezone_now()
time_next_min = (cur_time + timedelta(minutes=1)).replace(second=0, microsecond=0)