mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-21 22:17:59 +00:00
prevent sqlite database from locking up
This commit is contained in:
parent
b86159c7ae
commit
b259f2d760
|
@ -98,6 +98,7 @@ async def handle_follow(view: ActorView, conn: Connection) -> None:
|
|||
logging.verbose('Non-application actor tried to follow: %s', view.actor.id)
|
||||
return
|
||||
|
||||
with conn.transaction():
|
||||
if conn.get_inbox(view.actor.shared_inbox):
|
||||
view.instance = conn.update_inbox(view.actor.shared_inbox, followid = view.message.id)
|
||||
|
||||
|
@ -144,6 +145,7 @@ async def handle_undo(view: ActorView, conn: Connection) -> None:
|
|||
if view.instance['followid'] and view.instance['followid'] != view.message.object_id:
|
||||
return
|
||||
|
||||
with conn.transaction():
|
||||
if not conn.del_inbox(view.actor.id):
|
||||
logging.verbose(
|
||||
'Failed to delete "%s" with follow ID "%s"',
|
||||
|
@ -182,16 +184,18 @@ async def run_processor(view: ActorView) -> None:
|
|||
|
||||
return
|
||||
|
||||
with view.database.connection(True) as conn:
|
||||
with view.database.connection(False) as conn:
|
||||
if view.instance:
|
||||
if not view.instance['software']:
|
||||
if (nodeinfo := await view.client.fetch_nodeinfo(view.instance['domain'])):
|
||||
with conn.transaction():
|
||||
view.instance = conn.update_inbox(
|
||||
view.instance['inbox'],
|
||||
software = nodeinfo.sw_name
|
||||
)
|
||||
|
||||
if not view.instance['actor']:
|
||||
with conn.transaction():
|
||||
view.instance = conn.update_inbox(
|
||||
view.instance['inbox'],
|
||||
actor = view.actor.id
|
||||
|
|
Loading…
Reference in a new issue