2
0
Fork 0

Fix overwriting 'read' state of IncomingMessage every time it is "received"

This commit is contained in:
Luca 2023-05-07 22:24:22 +02:00
parent 1cbaf07cae
commit 8bd09a22ae
1 changed files with 8 additions and 6 deletions

View File

@ -16,12 +16,14 @@ def receive_messages():
from_dt = None from_dt = None
try: try:
for sms in list_incoming_sms(from_dt): for sms in reversed(list_incoming_sms(from_dt)):
IncomingMessage( IncomingMessage.objects.get_or_create(
id=sms.id, id=sms.id,
sender=sms.sender, defaults={
content=sms.content, "content": sms.content,
created_at=sms.created_at, "created_at": sms.created_at,
).save() "sender": sms.sender,
},
)
except Exception as e: except Exception as e:
sentry_sdk.capture_exception(e) sentry_sdk.capture_exception(e)