|
|
|
@ -5,6 +5,7 @@ from django.db import transaction
|
|
|
|
|
from django.utils import timezone
|
|
|
|
|
from dynamic_preferences.registries import global_preferences_registry
|
|
|
|
|
from .sipgate.sms import send as send_sms
|
|
|
|
|
import sentry_sdk
|
|
|
|
|
|
|
|
|
|
global_preferences = global_preferences_registry.manager()
|
|
|
|
|
|
|
|
|
@ -28,7 +29,7 @@ def send_messages():
|
|
|
|
|
print("sms disabled, not sending")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
msgs = Message.objects.select_for_update().filter(sent_at__isnull=True)
|
|
|
|
|
msgs = Message.objects.select_for_update().filter(sent_at__isnull=True)[:global_preferences['helper__sms_rate']*2]
|
|
|
|
|
with transaction.atomic():
|
|
|
|
|
for msg in msgs:
|
|
|
|
|
if msg.sent_at:
|
|
|
|
@ -37,8 +38,8 @@ def send_messages():
|
|
|
|
|
send(msg)
|
|
|
|
|
msg.sent_at = timezone.now()
|
|
|
|
|
msg.save()
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
except e:
|
|
|
|
|
sentry_sdk.capture_exception(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# singlemessage so registration links arrive faster.
|
|
|
|
|