Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 2b24954

Browse files
committed
Don't send application reminders if applications are closed
1 parent 1e6aff4 commit 2b24954

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tasks/handlers/communication/send_incomplete_reminder.py

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from opentelemetry import trace
55

6+
from common.database import ServiceSettings, db_context
67
from tasks.handlers.models import Response
78

89
from .shared import MessageTriggerType, send_incomplete_message
@@ -15,6 +16,12 @@
1516
async def handler(participant_id: int, kind: str, at: datetime) -> Response:
1617
trace.get_current_span().set_attribute("user.id", participant_id)
1718

19+
async with db_context() as db:
20+
accepting_applications = await ServiceSettings.accepting_applications(db).get()
21+
if not accepting_applications:
22+
logger.info("registration disabled, not sending reminder")
23+
return Response.success()
24+
1825
# Check if we need to delay allowing for some jitter
1926
delta = at - datetime.utcnow()
2027
if delta.total_seconds() > 5:

0 commit comments

Comments
 (0)