fix pyrogram task

This commit is contained in:
bakatrouble 2019-01-28 01:02:25 +03:00
parent 5306a033b2
commit dac3e21a00

View File

@ -4,7 +4,7 @@ from tempfile import TemporaryDirectory
import pytz import pytz
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models, transaction
from pyrogram import Chat as PyrogramChat, Message as PyrogramMessage from pyrogram import Chat as PyrogramChat, Message as PyrogramMessage
@ -49,6 +49,7 @@ class Chat(models.Model):
obj.photo_id = chat.photo.small_file_id obj.photo_id = chat.photo.small_file_id
obj.save() obj.save()
if created: if created:
transaction.commit()
collect_new_messages.delay(obj.pk) collect_new_messages.delay(obj.pk)
return obj return obj