From 699438602cbe5684631641a245c16558bccedd20 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 8 Nov 2023 23:03:21 +0000 Subject: [PATCH] Make import and export commands complete reliably. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4621 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/main.c | 1 + src/ssb.c | 5 +++++ src/ssb.h | 2 ++ src/ssb.rpc.c | 6 +++++- src/ssb.rpc.h | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 4e5f438f..ae9b59ad 100644 --- a/src/main.c +++ b/src/main.c @@ -307,6 +307,7 @@ static int _tf_run_task(const tf_run_args_t* args, int index) } tf_task_set_db_path(task, db_path); tf_task_activate(task); + tf_ssb_start_periodic(tf_task_get_ssb(task)); if (args->zip) { tf_ssb_import_from_zip(tf_task_get_ssb(task), args->zip, "core", "apps"); diff --git a/src/ssb.c b/src/ssb.c index bf116e9d..5366e312 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2168,6 +2168,11 @@ tf_ssb_t* tf_ssb_create(uv_loop_t* loop, JSContext* context, const char* db_path return ssb; } +void tf_ssb_start_periodic(tf_ssb_t* ssb) +{ + tf_ssb_rpc_start_periodic(ssb); +} + static void _tf_ssb_assert_not_main_thread(tf_ssb_t* ssb) { if (uv_thread_self() == ssb->thread_self) diff --git a/src/ssb.h b/src/ssb.h index 9571c9bd..b1df3215 100644 --- a/src/ssb.h +++ b/src/ssb.h @@ -81,6 +81,8 @@ typedef struct _tf_ssb_store_queue_t tf_ssb_t* tf_ssb_create(uv_loop_t* loop, JSContext* context, const char* db_path); void tf_ssb_destroy(tf_ssb_t* ssb); +void tf_ssb_start_periodic(tf_ssb_t* ssb); + sqlite3* tf_ssb_acquire_db_reader(tf_ssb_t* ssb); sqlite3* tf_ssb_acquire_db_reader_restricted(tf_ssb_t* ssb); void tf_ssb_release_db_reader(tf_ssb_t* ssb, sqlite3* db); diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index bc24db18..f0ac5d6f 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -1345,6 +1345,11 @@ static void _tf_ssb_rpc_start_delete_blobs(tf_ssb_t* ssb, int delay_ms) tf_ssb_ref(ssb); } +void tf_ssb_rpc_start_periodic(tf_ssb_t* ssb) +{ + _tf_ssb_rpc_start_delete_blobs(ssb, 0); +} + void tf_ssb_rpc_register(tf_ssb_t* ssb) { tf_ssb_add_connections_changed_callback(ssb, _tf_ssb_rpc_connections_changed_callback, NULL, NULL); @@ -1358,5 +1363,4 @@ void tf_ssb_rpc_register(tf_ssb_t* ssb) tf_ssb_add_rpc_callback(ssb, (const char*[]) { "room", "attendants", NULL }, _tf_ssb_rpc_room_attendants, NULL, NULL); /* SOURCE */ tf_ssb_add_rpc_callback(ssb, (const char*[]) { "createHistoryStream", NULL }, _tf_ssb_rpc_createHistoryStream, NULL, NULL); /* SOURCE */ tf_ssb_add_rpc_callback(ssb, (const char*[]) { "ebt", "replicate", NULL }, _tf_ssb_rpc_ebt_replicate_server, NULL, NULL); /* DUPLEX */ - _tf_ssb_rpc_start_delete_blobs(ssb, 0); } diff --git a/src/ssb.rpc.h b/src/ssb.rpc.h index 86d56c1d..b51a5645 100644 --- a/src/ssb.rpc.h +++ b/src/ssb.rpc.h @@ -3,3 +3,4 @@ typedef struct _tf_ssb_t tf_ssb_t; void tf_ssb_rpc_register(tf_ssb_t* ssb); +void tf_ssb_rpc_start_periodic(tf_ssb_t* ssb);