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

pull/1/head
Luca 2 years ago
parent 1cbaf07cae
commit 8bd09a22ae

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

Loading…
Cancel
Save