From c1ec150696aeb7451b85e8cb4f807feb46556b52 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 8 Jul 2023 13:43:44 +0000 Subject: [PATCH] SHA256 was sticking out on a profile, so don't unnecessarily hold the DB writer while we're doing that. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4342 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ssb.db.c b/src/ssb.db.c index 5b0c343e..31202b11 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -448,8 +448,6 @@ bool tf_ssb_db_blob_get(tf_ssb_t* ssb, const char* id, uint8_t** out_blob, size_ bool tf_ssb_db_blob_store(tf_ssb_t* ssb, const uint8_t* blob, size_t size, char* out_id, size_t out_id_size, bool* out_new) { bool result = false; - sqlite3* db = tf_ssb_acquire_db_writer(ssb); - sqlite3_stmt* statement; uint8_t hash[crypto_hash_sha256_BYTES]; crypto_hash_sha256(hash, blob, size); @@ -462,6 +460,8 @@ bool tf_ssb_db_blob_store(tf_ssb_t* ssb, const uint8_t* blob, size_t size, char* int rows = 0; + sqlite3* db = tf_ssb_acquire_db_writer(ssb); + sqlite3_stmt* statement; if (sqlite3_prepare(db, "INSERT INTO blobs (id, content, created) VALUES ($1, $2, CAST(strftime('%s') AS INTEGER)) ON CONFLICT DO NOTHING", -1, &statement, NULL) == SQLITE_OK) { if (sqlite3_bind_text(statement, 1, id, -1, NULL) == SQLITE_OK &&