ssb: Don't schedule duplicate history stream requests for the same account. Changes how we schedule idle work. Let's see if this is better.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 22m35s

This commit is contained in:
2024-12-27 15:02:52 -05:00
parent 4127898655
commit 9cddd93dad
3 changed files with 67 additions and 25 deletions

View File

@ -799,17 +799,19 @@ JSValue tf_ssb_connection_requests_to_object(tf_ssb_connection_t* connection);
/**
** A function scheduled to be run later.
** @param connection The owning connection.
** @param skip Whether the work ought to be skipped, because it is being replaced.
** @param user_data User data registered with the callback.
*/
typedef void(tf_ssb_scheduled_callback_t)(tf_ssb_connection_t* connection, void* user_data);
typedef void(tf_ssb_scheduled_callback_t)(tf_ssb_connection_t* connection, bool skip, void* user_data);
/**
** Schedule work to be run when the connection is next idle.
** @param connection The owning connection.
** @param key A key identifying the work. If work by the same key already exists, it will be replaced.
** @param callback The callback to call.
** @param user_data User data to pass to the callback.
*/
void tf_ssb_connection_schedule_idle(tf_ssb_connection_t* connection, tf_ssb_scheduled_callback_t* callback, void* user_data);
void tf_ssb_connection_schedule_idle(tf_ssb_connection_t* connection, const char* key, tf_ssb_scheduled_callback_t* callback, void* user_data);
/**
** Schedule work to run on a worker thread.