Bug/multiple events (#631)
* add --preload * formatting * use sql database Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
b2eaf1ee02
commit
bf06482b29
4 changed files with 13 additions and 10 deletions
|
@ -151,6 +151,8 @@ class AppSettings(BaseSettings):
|
|||
DEFAULT_EMAIL: str = "changeme@email.com"
|
||||
DEFAULT_PASSWORD: str = "MyPassword"
|
||||
|
||||
SCHEDULER_DATABASE = f"sqlite:///{app_dirs.DATA_DIR.joinpath('scheduler.db')}"
|
||||
|
||||
TOKEN_TIME: int = 2 # Time in Hours
|
||||
|
||||
# Not Used!
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import json
|
||||
from mealie.routes.routers import UserAPIRouter
|
||||
import shutil
|
||||
from shutil import copyfileobj
|
||||
from zipfile import ZipFile
|
||||
|
@ -11,6 +10,7 @@ from mealie.core.root_logger import get_logger
|
|||
from mealie.db.database import db
|
||||
from mealie.db.db_setup import generate_session
|
||||
from mealie.routes.deps import get_current_user, is_logged_in, temporary_zip_path
|
||||
from mealie.routes.routers import UserAPIRouter
|
||||
from mealie.schema.recipe import Recipe, RecipeAsset, RecipeImageTypes, RecipeURLIn
|
||||
from mealie.schema.user import UserInDB
|
||||
from mealie.services.events import create_recipe_event
|
||||
|
@ -185,16 +185,15 @@ def delete_recipe(
|
|||
try:
|
||||
recipe: Recipe = db.recipes.delete(session, recipe_slug)
|
||||
delete_assets(recipe_slug=recipe_slug)
|
||||
background_tasks.add_task(
|
||||
create_recipe_event,
|
||||
"Recipe Deleted",
|
||||
f"'{recipe.name}' deleted by {current_user.full_name}",
|
||||
session=session,
|
||||
)
|
||||
return recipe
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
background_tasks.add_task(
|
||||
create_recipe_event, "Recipe Deleted", f"'{recipe.name}' deleted by {current_user.full_name}", session=session
|
||||
)
|
||||
|
||||
return recipe
|
||||
|
||||
|
||||
@user_router.put("/{recipe_slug}/image")
|
||||
def update_recipe_image(
|
||||
|
|
|
@ -54,5 +54,5 @@ else
|
|||
|
||||
# Start API
|
||||
# uvicorn mealie.app:app --host 0.0.0.0 --port 9000
|
||||
gunicorn mealie.app:app -b 0.0.0.0:9000 -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py
|
||||
gunicorn mealie.app:app -b 0.0.0.0:9000 -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload
|
||||
fi
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from mealie.core.config import settings
|
||||
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler = BackgroundScheduler(jobstores={"default": SQLAlchemyJobStore(settings.SCHEDULER_DATABASE)})
|
||||
|
|
Loading…
Reference in a new issue