Skip to content

Commit

Permalink
Merge pull request #7 from telling-me/develop
Browse files Browse the repository at this point in the history
미션 업데이트 api 추가
  • Loading branch information
taewoo-dev authored Dec 18, 2024
2 parents a580102 + 439b325 commit ad82de9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
22 changes: 22 additions & 0 deletions scripts/deploy-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# src 디렉토리로 이동
cd "$(dirname "$0")/../src" || exit

# 실행 중인 Gunicorn 프로세스 종료
echo "Stopping Gunicorn..."
killall gunicorn 2>/dev/null || echo "No Gunicorn processes found."

# 실행 중인 Celery 워커 프로세스 종료
echo "Stopping Celery workers..."
pkill -f "celery -A celery_worker worker" 2>/dev/null || echo "No Celery worker processes found."

# 새로운 Celery 워커 시작
echo "Starting Celery workers..."
PYTHONPATH=$(pwd) /home/ubuntu/.cache/pypoetry/virtualenvs/tellingme-python-server-p3Rjg27q-py3.12/bin/python -m celery -A celery_worker worker --loglevel=info --concurrency=1 &

# 새로운 Gunicorn 시작
echo "Starting Gunicorn..."
poetry run nohup gunicorn main:app --workers 2 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 >> gunicorn.log 2>&1 &

echo "Services restarted successfully."
2 changes: 1 addition & 1 deletion src/app/v2/answers/models/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from app.v2.answers.querys.answer_query import (
SELECT_ANSWER_BY_USER_UUID_QUERY,
SELECT_ANSWER_COUNT_BY_USER_UUID_QUERY,
SELECT_MOST_RECENT_ANSWER_BY_USER_UUID_QUERY,
SELECT_ANSWER_COUNT_BY_USER_UUID_QUERY_V2,
SELECT_MOST_RECENT_ANSWER_BY_USER_UUID_QUERY,
)
from app.v2.users.models.user import User
from common.utils.query_executor import QueryExecutor
Expand Down
18 changes: 17 additions & 1 deletion src/app/v2/missions/router.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from fastapi import APIRouter
from typing import Any

from fastapi import APIRouter, Depends

from app.v2.missions.services.mission_service import MissionService
from core.configs.celery_settings import process_mission_in_background

router = APIRouter(prefix="/mission", tags=["Mission"])
Expand All @@ -8,3 +11,16 @@
@router.get("")
async def mission_handler(user_id: str) -> None:
process_mission_in_background.delay(user_id)


@router.get("/direct")
async def mission_handler_direct(
user_id: str,
mission_service: MissionService = Depends(),
) -> dict[str, Any]:
await mission_service.update_mission_progress(user_id=user_id)
return {
"code": 200,
"message": "success",
"data": True,
}

0 comments on commit ad82de9

Please sign in to comment.