db: Migrate to SQLite, improve performance

This commit is contained in:
beerpiss
2023-08-17 17:16:05 +07:00
parent fc947d36a5
commit f07d60f8ce
107 changed files with 15925 additions and 14210 deletions

View File

@ -13,6 +13,7 @@ from twisted.web.http import Request
from routes import Mapper
from threading import Thread
class HttpDispatcher(resource.Resource):
def __init__(self, cfg: CoreConfig, config_dir: str):
super().__init__()
@ -188,16 +189,22 @@ class HttpDispatcher(resource.Resource):
if type(ret) == str:
return ret.encode()
elif type(ret) == bytes or type(ret) == tuple: # allow for bytes or tuple (data, response code) responses
elif (
type(ret) == bytes or type(ret) == tuple
): # allow for bytes or tuple (data, response code) responses
return ret
elif ret is None:
self.logger.warn(f"None returned by controller for {request.uri.decode()} endpoint")
self.logger.warn(
f"None returned by controller for {request.uri.decode()} endpoint"
)
return b""
else:
self.logger.warn(f"Unknown data type returned by controller for {request.uri.decode()} endpoint")
self.logger.warn(
f"Unknown data type returned by controller for {request.uri.decode()} endpoint"
)
return b""