commit 1d1f942bc29b2b7c026699275cc9f490d9fc7e7e
parent 389dde46e84f1284742ae008fd062a32da5a3634
Author: Stefan Koch <programming@stefan-koch.name>
Date: Sun, 4 Jul 2021 18:17:16 +0200
need UUIDs for DB for multiple parallel runs
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/anki b/anki
@@ -11,7 +11,8 @@ all_query="SELECT COUNT(*) FROM cards c JOIN decks d ON c.did = d.id WHERE d.nam
# TODO: Is there really no other way to work around the exclusive lock that
# Anki or AnkiConnect seems to hold than copying the whole database?
-tmp_db=/tmp/anki.sqlite3
+uuid=$(uuidgen)
+tmp_db=/tmp/anki-${uuid}.sqlite3
cp "$ANKI_COLLECTION_PATH" $tmp_db
learning_count=$(sqlite3 -readonly $tmp_db "$learning_query")
all_count=$(sqlite3 -readonly $tmp_db "$all_query")