why
parent
5db7b20e9f
commit
d3927f5bca
Binary file not shown.
Binary file not shown.
|
@ -355,12 +355,12 @@ async def main():
|
||||||
raise RuntimeError("Set the DISCORD_TOKEN environment variable or add it to a .env file.")
|
raise RuntimeError("Set the DISCORD_TOKEN environment variable or add it to a .env file.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
web_task = server.app.run_task(host="0.0.0.0", port=8000, debug=False)
|
web_task = asyncio.create_task(server.app.run_task(host="0.0.0.0", port=8000, debug=False))
|
||||||
discord_task = start_discord()
|
discord_task = asyncio.create_task(start_discord())
|
||||||
|
|
||||||
await asyncio.gather(web_task, discord_task)
|
await asyncio.wait({web_task, discord_task}, return_when=asyncio.FIRST_COMPLETED)
|
||||||
finally:
|
finally:
|
||||||
await PlaywrightPool.stop()
|
# await PlaywrightPool.stop()
|
||||||
server.article_repository.close()
|
server.article_repository.close()
|
||||||
|
|
||||||
if not bot.is_closed():
|
if not bot.is_closed():
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from quart import Quart, request, jsonify, abort
|
from quart import Quart, request, jsonify, abort, send_from_directory
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -12,6 +12,10 @@ article_repository = ArticleRepository()
|
||||||
|
|
||||||
LOGGER = logging.getLogger("server")
|
LOGGER = logging.getLogger("server")
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
async def index():
|
||||||
|
return await send_from_directory("static", "index.html")
|
||||||
|
|
||||||
@app.route("/health")
|
@app.route("/health")
|
||||||
async def health():
|
async def health():
|
||||||
return {"status": "ok"}
|
return {"status": "ok"}
|
||||||
|
|
Loading…
Reference in New Issue