Skip to content

Commit

Permalink
chore: clean up some code
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Dec 20, 2024
1 parent 77599f7 commit c6885aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ ENV PYTHONUNBUFFERED=1 \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
\
# paths
# this is where our requirements + virtual environment will live
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"


# prepend poetry and venv to path


# `builder-base` stage is used to build deps + create our virtual environment
FROM python-base AS builder-base
RUN apt-get update \
Expand Down
10 changes: 8 additions & 2 deletions compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


services:
web: &sync
develop:
Expand All @@ -12,10 +10,18 @@ services:
- action: rebuild
path: ./poetry.lock


image: hackathonscanada:latest
container_name: web

celery_worker:
<<: *sync
image: hackathonscanada:latest
container_name: celery_worker

celery_beat:
<<: *sync
image: hackathonscanada:latest
container_name: celery_beat


4 changes: 2 additions & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
- valkey
healthcheck:
test:
["CMD", "/opt/pysetup/.venv/bin/celery", "worker", "--loglevel=info"]
["CMD", "/opt/pysetup/.venv/bin/celery", "worker", "-A", "hackathons_canada", "--loglevel=info"]
interval: 10s
retries: 5

Expand All @@ -52,7 +52,7 @@ services:
depends_on:
- valkey
healthcheck:
test: ["CMD", "/opt/pysetup/.venv/bin/celery", "beat", "--loglevel=info"]
test: ["CMD", "/opt/pysetup/.venv/bin/celery", "beat", "-A", "hackathons_canada", "--loglevel=info"]
interval: 10s
retries: 5

Expand Down
7 changes: 5 additions & 2 deletions core/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from celery.utils.log import get_task_logger
from django.db.models.signals import post_save
from django.dispatch import receiver
from core.tasks import send_instant_notification

from core.models import Hackathon

Expand All @@ -12,9 +13,11 @@
logger = get_task_logger(__name__)


@receiver(post_save, sender=Hackathon)
@receiver(
post_save, sender=Hackathon
) # todo: change to custom "Hackathon posted" signal
async def new_hackathon_notif(sender, instance, created, **kwargs):
if not created:
return # only notify on creation
# todo run a task to notify hackers who signed up for this hackathon and are their preferences are set to receive notifications within the radius of the hackathon
send_instant_notification.delay(instance.id)
logger.debug(f"New hackathon created: {instance}")
1 change: 0 additions & 1 deletion scripts/db-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ ALTER ROLE neondb_owner SET client_encoding TO 'utf8';
ALTER ROLE neondb_owner SET default_transaction_isolation TO 'read committed';
ALTER ROLE neondb_owner SET timezone TO 'UTC';


CREATE EXTENSION IF NOT EXISTS postgis;

0 comments on commit c6885aa

Please sign in to comment.