call jobs in logic

pull/935/head
Jeff Becker 5 years ago committed by Jason Rhinelander
parent f5ede2d875
commit fba1e47d1c

@ -82,6 +82,12 @@ namespace llarp
#endif
self->m_Killer.TryAccess(func);
};
if(can_flush())
{
METRIC("fired");
f();
return true;
}
if(m_Thread->LooksFull(5))
{
LogWarnExplicit(TAG, LINE,
@ -89,17 +95,6 @@ namespace llarp
"thread but "
"it looks full");
METRIC("full");
if(can_flush())
{
// we are calling in the logic thread and our queue looks full
// defer call to a later time so we don't die like a little bitch
const auto delay = m_Thread->GuessJobLatency() / 2;
LogWarnExplicit(TAG, LINE, "deferring call by ", delay, " ms");
METRIC("defer");
call_later(delay, f);
return true;
}
}
auto ret = llarp_threadpool_queue_job(m_Thread, f);
if(not ret)

Loading…
Cancel
Save