This commit is contained in:
Izalia Mae 2024-02-19 23:05:47 -05:00
parent fad4b7ce82
commit 162f813c05
4 changed files with 8 additions and 14 deletions

View file

@ -202,14 +202,10 @@ class CacheCleanupThread(Thread):
def run(self) -> None: def run(self) -> None:
cache = get_cache(self.app)
while self.running.is_set(): while self.running.is_set():
time.sleep(3600) time.sleep(3600)
logging.verbose("Removing old cache items") logging.verbose("Removing old cache items")
cache.delete_old(14) self.app.cache.delete_old(14)
cache.close()
def start(self) -> None: def start(self) -> None:

View file

@ -3,6 +3,7 @@ from __future__ import annotations
import Crypto import Crypto
import asyncio import asyncio
import click import click
import os
import platform import platform
import subprocess import subprocess
import sys import sys
@ -238,9 +239,12 @@ def cli_run(ctx: click.Context, dev: bool = False) -> None:
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
subprocess.run([sys.executable, 'run-gunicorn'], check = False) subprocess.run([sys.executable, 'run-gunicorn'], check = False)
return
ctx.obj.run(dev) else:
ctx.obj.run(dev)
# todo: figure out why the relay doesn't quit properly without this
os._exit(0)
@cli.command('run-gunicorn') @cli.command('run-gunicorn')

View file

@ -170,12 +170,6 @@ class Inbox(View):
with self.database.session() as conn: with self.database.session() as conn:
for inbox in conn.execute('SELECT * FROM inboxes'): for inbox in conn.execute('SELECT * FROM inboxes'):
try:
created = datetime.fromtimestamp(inbox['created'], tz = timezone.utc)
except TypeError:
created = datetime.fromisoformat(inbox['created'])
inbox['created'] = created.isoformat() inbox['created'] = created.isoformat()
data.append(inbox) data.append(inbox)

View file

@ -46,7 +46,7 @@ class HomeView(View):
async def get(self, request: Request) -> Response: async def get(self, request: Request) -> Response:
with self.database.session() as conn: with self.database.session() as conn:
config = conn.get_config_all() config = conn.get_config_all()
inboxes = conn.execute('SELECT * FROM inboxes').all() inboxes = tuple(conn.execute('SELECT * FROM inboxes').all())
text = HOME_TEMPLATE.format( text = HOME_TEMPLATE.format(
host = self.config.domain, host = self.config.domain,