Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

#265: Rate limit amount of Tasks can be completed in one update #284

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions hooks/InnerNetClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,24 @@ void dInnerNetClient_Update(InnerNetClient* __this, MethodInfo* method)
else {
if (!State.rpcQueue.empty()) {
auto rpc = State.rpcQueue.front();
State.rpcQueue.pop();

rpc->Process();
//Looks like there is a check on Task completion when u are dead.
//The maximum amount of Tasks that can be completed per Update is at 6.
auto maxProcessedTasks = 6;
auto processedTaskCompletes = 0;
if (dynamic_cast<RpcCompleteTask*>(rpc))
{
if (processedTaskCompletes < maxProcessedTasks)
{
State.rpcQueue.pop();
rpc->Process();
processedTaskCompletes++;
}
}
else
{
State.rpcQueue.pop();
rpc->Process();
}
delete rpc;
}

Expand Down