-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed dep fatapi-cli and added logging
- Loading branch information
1 parent
c49c63a
commit e847a9c
Showing
7 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
import asyncio | ||
import logging | ||
|
||
from sqlalchemy.orm import Session | ||
|
||
from . import crud | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
async def delete_expired_paste_task(interval: float, db: Session): | ||
while True: | ||
run = 1 | ||
logger.info(f"Task started: delete-expired-paste after each {interval}s.") | ||
while run: | ||
try: | ||
await asyncio.sleep(interval) | ||
except asyncio.CancelledError: | ||
return | ||
run = False | ||
else: | ||
crud.delete_expired_pastes(db) | ||
|
||
logger.info("Task ended: delete-expired-paste.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: 1 | ||
disable_existing_loggers: False | ||
formatters: | ||
default: | ||
# "()": uvicorn.logging.DefaultFormatter | ||
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
access: | ||
# "()": uvicorn.logging.AccessFormatter | ||
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
handlers: | ||
default: | ||
formatter: default | ||
class: logging.StreamHandler | ||
stream: ext://sys.stderr | ||
access: | ||
formatter: access | ||
class: logging.StreamHandler | ||
stream: ext://sys.stdout | ||
loggers: | ||
uvicorn.error: | ||
level: INFO | ||
handlers: | ||
- default | ||
propagate: no | ||
uvicorn.access: | ||
level: INFO | ||
handlers: | ||
- access | ||
propagate: no | ||
root: | ||
level: DEBUG | ||
handlers: | ||
- default | ||
propagate: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters