2 Commits

Author SHA1 Message Date
Stepan Vladovskiy
e1d1096674 feat: without staging deploying by gitea
All checks were successful
Deploy on push / deploy (push) Successful in 6s
2025-06-02 18:17:24 -03:00
Stepan Vladovskiy
82870a4e47 debug: prechase wrapped for time out
All checks were successful
Deploy on push / deploy (push) Successful in 1m15s
2025-05-20 11:26:30 -03:00
2 changed files with 12 additions and 6 deletions

View File

@@ -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/feat/sv-search-v4' if: github.ref == 'refs/heads/staging'
uses: dokku/github-action@master uses: dokku/github-action@master
with: with:
branch: 'dev' branch: 'dev'

16
main.py
View File

@@ -42,6 +42,15 @@ async def check_search_service():
else: else:
print(f"[INFO] Search service is available: {info}") print(f"[INFO] Search service is available: {info}")
# Helper to run precache with timeout and catch errors
async def precache_with_timeout():
try:
await asyncio.wait_for(precache_data(), timeout=60)
except asyncio.TimeoutError:
print("[precache] Precache timed out after 60 seconds")
except Exception as e:
print(f"[precache] Error during precache: {e}")
# indexing DB data # indexing DB data
# async def indexing(): # async def indexing():
@@ -53,11 +62,8 @@ async def lifespan(_app):
print("[lifespan] Starting application initialization") print("[lifespan] Starting application initialization")
create_all_tables() create_all_tables()
# schedule precaching in background to avoid blocking startup # schedule precaching in background with timeout and error handling
asyncio.create_task( asyncio.create_task(precache_with_timeout())
asyncio.wait_for(precache_data(), timeout=60)
.catch(asyncio.TimeoutError, lambda _: print("Precache timed out"))
)
await asyncio.gather( await asyncio.gather(
redis.connect(), redis.connect(),