Fix exception reporting

pull/1/head
Luca 3 years ago
parent 73d214615e
commit df9493f6cd

@ -49,8 +49,10 @@ class CancelMin(types.DurationPreference):
name = "min_cancel_time" name = "min_cancel_time"
default = datetime.timedelta(hours=6) default = datetime.timedelta(hours=6)
@global_preferences_registry.register @global_preferences_registry.register
class SMSRate(types.IntegerPreference): class SMSRate(types.IntegerPreference):
section = helper section = helper
name = "sms_rate" name = "sms_rate"
default = 2 default = 2
help_text = "Number of SMS sent per minute"

@ -29,7 +29,9 @@ 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)[:global_preferences['helper__sms_rate']*2] 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:
@ -38,7 +40,7 @@ def send_messages():
send(msg) send(msg)
msg.sent_at = timezone.now() msg.sent_at = timezone.now()
msg.save() msg.save()
except e: except Exception as e:
sentry_sdk.capture_exception(e) sentry_sdk.capture_exception(e)
@ -80,5 +82,5 @@ def send_reminders():
continue continue
try: try:
reg.send_reminder() reg.send_reminder()
except: except Exception as e:
pass sentry_sdk.capture_exception(e)

@ -1,3 +1 @@
<div class="content"> <h5 class="subtitle">Hier erscheint bald die Karte mit allen Schichtstandorten</h5>
<h5 class="mb-2">Hier erscheint bald die Karte mit allen Schichtstandorten</h5>
</div>

Loading…
Cancel
Save