|
|
@ -5,6 +5,7 @@ from django.db import transaction
|
|
|
|
from django.utils import timezone
|
|
|
|
from django.utils import timezone
|
|
|
|
from dynamic_preferences.registries import global_preferences_registry
|
|
|
|
from dynamic_preferences.registries import global_preferences_registry
|
|
|
|
from .sipgate.sms import send as send_sms
|
|
|
|
from .sipgate.sms import send as send_sms
|
|
|
|
|
|
|
|
import sentry_sdk
|
|
|
|
|
|
|
|
|
|
|
|
global_preferences = global_preferences_registry.manager()
|
|
|
|
global_preferences = global_preferences_registry.manager()
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +29,7 @@ def send_messages():
|
|
|
|
print("sms disabled, not sending")
|
|
|
|
print("sms disabled, not sending")
|
|
|
|
return
|
|
|
|
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():
|
|
|
|
with transaction.atomic():
|
|
|
|
for msg in msgs:
|
|
|
|
for msg in msgs:
|
|
|
|
if msg.sent_at:
|
|
|
|
if msg.sent_at:
|
|
|
@ -37,8 +38,8 @@ def send_messages():
|
|
|
|
send(msg)
|
|
|
|
send(msg)
|
|
|
|
msg.sent_at = timezone.now()
|
|
|
|
msg.sent_at = timezone.now()
|
|
|
|
msg.save()
|
|
|
|
msg.save()
|
|
|
|
except:
|
|
|
|
except e:
|
|
|
|
pass
|
|
|
|
sentry_sdk.capture_exception(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# singlemessage so registration links arrive faster.
|
|
|
|
# singlemessage so registration links arrive faster.
|
|
|
|