mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-14 03:27:59 +00:00
Compare commits
2 commits
89300057ef
...
d42b939db9
Author | SHA1 | Date | |
---|---|---|---|
d42b939db9 | |||
42c838715b |
|
@ -17,11 +17,11 @@ if typing.TYPE_CHECKING:
|
||||||
|
|
||||||
def get_database(config: Config, migrate: bool = True) -> tinysql.Database:
|
def get_database(config: Config, migrate: bool = True) -> tinysql.Database:
|
||||||
if config.db_type == "sqlite":
|
if config.db_type == "sqlite":
|
||||||
# todo: remove check_same_thread when tinysql stores connections per thread
|
|
||||||
db = tinysql.Database.sqlite(
|
db = tinysql.Database.sqlite(
|
||||||
config.sqlite_path,
|
config.sqlite_path,
|
||||||
connection_class = Connection,
|
connection_class = Connection,
|
||||||
check_same_thread = False
|
min_connections = 2,
|
||||||
|
max_connections = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
elif config.db_type == "postgres":
|
elif config.db_type == "postgres":
|
||||||
|
|
|
@ -143,6 +143,7 @@ class HttpClient:
|
||||||
async def post(self, url: str, message: Message) -> None:
|
async def post(self, url: str, message: Message) -> None:
|
||||||
await self.open()
|
await self.open()
|
||||||
|
|
||||||
|
# todo: cache inboxes to avoid opening a db connection
|
||||||
with get_app().database.connection() as conn:
|
with get_app().database.connection() as conn:
|
||||||
instance = conn.get_inbox(url)
|
instance = conn.get_inbox(url)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ from aputils.errors import SignatureFailureError
|
||||||
from aputils.misc import Digest, HttpDate, Signature
|
from aputils.misc import Digest, HttpDate, Signature
|
||||||
from aputils.objects import Nodeinfo, Webfinger, WellKnownNodeinfo
|
from aputils.objects import Nodeinfo, Webfinger, WellKnownNodeinfo
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from . import logger as logging
|
from . import logger as logging
|
||||||
|
|
|
@ -3,4 +3,4 @@ aputils@https://git.barkshark.xyz/barkshark/aputils/archive/0.1.6a.tar.gz
|
||||||
cachetools>=5.2.0
|
cachetools>=5.2.0
|
||||||
click>=8.1.2
|
click>=8.1.2
|
||||||
pyyaml>=6.0
|
pyyaml>=6.0
|
||||||
tinysql@https://git.barkshark.xyz/barkshark/tinysql/archive/0.2.1.tar.gz
|
tinysql@git+https://git.barkshark.xyz/barkshark/tinysql@3d94193ee4
|
||||||
|
|
Loading…
Reference in a new issue