Skip to content

Commit

Permalink
Refactor FaabricEndpointHandler and Scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
DonaldJennings committed Feb 14, 2024
1 parent 6dd73dd commit f2f0184
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/endpoint/FaabricEndpointHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void FaabricEndpointHandler::onFunctionResult(

response.body() = result.outputdata();
SPDLOG_DEBUG("Worker thread {} sending response", gettid());
ctx.sendFunction(std::move(response));
return ctx.sendFunction(std::move(response));
SPDLOG_DEBUG("Worker thread {} response sent", gettid());
// We're done with this request
}
Expand Down
5 changes: 3 additions & 2 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,20 +618,21 @@ faabric::util::SchedulingDecision Scheduler::doSchedulingDecision(

faabric::HostResources r = getHostResources(h);
int available = r.slots() - r.usedslots();

// We need to floor at zero here in case the remote host is
// overloaded, in which case its used slots will be greater than
// its available slots.
available = std::max<int>(0, available);
int nOnThisHost = std::min(available, remainder);

SPDLOG_DEBUG("Unregisted Host Available Slots: {}, nOnThisHost: {}", available, nOnThisHost);

if (topologyHint ==
faabric::util::SchedulingTopologyHint::NEVER_ALONE &&
nOnThisHost < 2) {
continue;
}

SPDLOG_TRACE("Scheduling {}/{} of {} on {} (unregistered)",
SPDLOG_DEBUG("Scheduling {}/{} of {} on {} (unregistered)",
nOnThisHost,
nMessages,
funcStr,
Expand Down

0 comments on commit f2f0184

Please sign in to comment.