# Self hosted sync server locks db

**URL:** <https://forums.ankiweb.net/t/self-hosted-sync-server-locks-db/30234>\
**Category:** Development\
**Created:** [May 11, 2023, 11:54pm UTC](https://forums.ankiweb.net/t/self-hosted-sync-server-locks-db/30234 "2023-05-11T23:54:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tapping8703](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@Tapping8703](https://forums.ankiweb.net/u/Tapping8703)\
**Post date:** [May 11, 2023, 11:54pm UTC](https://forums.ankiweb.net/t/self-hosted-sync-server-locks-db/30234/1 "2023-05-11T23:54:44Z")

</div>

I’ve been playing around with using the self hosting sync server Anki comes bundled with, and while testing it I noticed that I can’t run any commands on a db after I’ve synced because the database is locked. This is a bit of a bummer because I want to be able to modify my cards programmatically, but this would require me to kill the server, make the changes, and restart the server.

I think closing the connection after some of the terminal events for a sync (finish, abort ) would be a way to fix this.

I would submit a pr for this, but due to my inexperience with rust, I was unable to get a build of the sync server running, or admittedly even figure out where to begin.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [May 12, 2023, 6:21am UTC](https://forums.ankiweb.net/t/self-hosted-sync-server-locks-db/30234/2 "2023-05-12T06:21:43Z")

</div>

If you wish to make programmatic changes, you can make them to the database of one of your clients, and then sync the changes to the server. You will still need to ensure you make them via Anki’s API to ensure the changes are flagged as needing to be synced.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [June 11, 2023, 6:21am UTC](https://forums.ankiweb.net/t/self-hosted-sync-server-locks-db/30234/3 "2023-06-11T06:21:52Z")

</div>

Closed on June 11, 2023, 6:21am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
