forked from cory/tildefriends
Fix a stall where we would process one scheduled task and then leave the rest until we wake up again from network traffic.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4338 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
d06aea2831
commit
a4acee4939
@ -1740,7 +1740,8 @@ void tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui
|
|||||||
|
|
||||||
static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection)
|
static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection)
|
||||||
{
|
{
|
||||||
if (connection->scheduled_count)
|
const int k_scheduled_batch_count = 8;
|
||||||
|
for (int i = 0; i < k_scheduled_batch_count && connection->scheduled_count; i++)
|
||||||
{
|
{
|
||||||
tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0];
|
tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0];
|
||||||
memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1));
|
memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1));
|
||||||
@ -1749,6 +1750,10 @@ static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connectio
|
|||||||
scheduled.callback(connection, scheduled.user_data);
|
scheduled.callback(connection, scheduled.user_data);
|
||||||
tf_trace_end(connection->ssb->trace);
|
tf_trace_end(connection->ssb->trace);
|
||||||
}
|
}
|
||||||
|
if (connection->scheduled_count)
|
||||||
|
{
|
||||||
|
uv_async_send(&connection->async);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const char* reason)
|
static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const char* reason)
|
||||||
|
Loading…
Reference in New Issue
Block a user