debug: moved precache to background to avoid stucking ...
All checks were successful
Deploy on push / deploy (push) Successful in 45s
All checks were successful
Deploy on push / deploy (push) Successful in 45s
This commit is contained in:
parent
2bebfbd4df
commit
44aef147b5
|
@ -35,7 +35,7 @@ jobs:
|
||||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Push to dokku for staging branch
|
- name: Push to dokku for staging branch
|
||||||
if: github.ref == 'refs/heads/staging'
|
if: github.ref == 'refs/heads/feat/sv-search-v4'
|
||||||
uses: dokku/github-action@master
|
uses: dokku/github-action@master
|
||||||
with:
|
with:
|
||||||
branch: 'dev'
|
branch: 'dev'
|
||||||
|
|
4
main.py
4
main.py
|
@ -17,7 +17,6 @@ from cache.revalidator import revalidation_manager
|
||||||
from services.exception import ExceptionHandlerMiddleware
|
from services.exception import ExceptionHandlerMiddleware
|
||||||
from services.redis import redis
|
from services.redis import redis
|
||||||
from services.schema import create_all_tables, resolvers
|
from services.schema import create_all_tables, resolvers
|
||||||
#from services.search import search_service
|
|
||||||
from services.search import search_service, initialize_search_index
|
from services.search import search_service, initialize_search_index
|
||||||
from services.viewed import ViewedStorage
|
from services.viewed import ViewedStorage
|
||||||
from services.webhook import WebhookEndpoint, create_webhook_endpoint
|
from services.webhook import WebhookEndpoint, create_webhook_endpoint
|
||||||
|
@ -53,9 +52,10 @@ async def lifespan(_app):
|
||||||
try:
|
try:
|
||||||
print("[lifespan] Starting application initialization")
|
print("[lifespan] Starting application initialization")
|
||||||
create_all_tables()
|
create_all_tables()
|
||||||
|
# schedule precaching in background to avoid blocking startup
|
||||||
|
asyncio.create_task(precache_data())
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
redis.connect(),
|
redis.connect(),
|
||||||
precache_data(),
|
|
||||||
ViewedStorage.init(),
|
ViewedStorage.init(),
|
||||||
create_webhook_endpoint(),
|
create_webhook_endpoint(),
|
||||||
check_search_service(),
|
check_search_service(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user