From dac3e21a00b78840a39b6f2145844d246ee65aac Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 28 Jan 2019 01:02:25 +0300 Subject: [PATCH] fix pyrogram task --- aggregator/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aggregator/models.py b/aggregator/models.py index 8f8be8e..71b790e 100644 --- a/aggregator/models.py +++ b/aggregator/models.py @@ -4,7 +4,7 @@ from tempfile import TemporaryDirectory import pytz 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 @@ -49,6 +49,7 @@ class Chat(models.Model): obj.photo_id = chat.photo.small_file_id obj.save() if created: + transaction.commit() collect_new_messages.delay(obj.pk) return obj