Skip to content

Commit

Permalink
fix: remove reverse on event sort
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Sep 25, 2024
1 parent 839d63c commit 13a278f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ bin/
*.bin
.secrets*
event.json
*.patch

# Python bytecode / Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
29 changes: 21 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ apprise = "^1.8.1"
subliminal = "^2.2.1"
rank-torrent-name = "^1.0.2"
jsonschema = "^4.23.0"
scalar-fastapi = "^1.0.3"

[tool.poetry.group.dev.dependencies]
pyright = "^1.1.352"
Expand Down
9 changes: 9 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from controllers.tmdb import router as tmdb_router
from controllers.webhooks import router as webhooks_router
from controllers.ws import router as ws_router
from scalar_fastapi import get_scalar_api_reference
from program import Program
from program.settings.models import get_version
from utils.cli import handle_args
Expand Down Expand Up @@ -52,6 +53,14 @@ async def dispatch(self, request: Request, call_next):
"url": "https://www.gnu.org/licenses/gpl-3.0.en.html",
},
)

@app.get("/scalar", include_in_schema=False)
async def scalar_html():
return get_scalar_api_reference(
openapi_url=app.openapi_url,
title=app.title,
)

app.program = Program()

app.add_middleware(LoguruMiddleware)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def next(self):
while True:
if self._queued_events:
with self.mutex:
self._queued_events.sort(key=lambda event: event.run_at, reverse=True)
self._queued_events.sort(key=lambda event: event.run_at)
if datetime.now() >= self._queued_events[0].run_at:
event = self._queued_events.pop(0)
return event
Expand Down

0 comments on commit 13a278f

Please sign in to comment.