Skip to content

Commit

Permalink
treat waiting for first subforkit child like first child
Browse files Browse the repository at this point in the history
as in, with a longer timeout.

Signed-off-by: Caolán McNamara <[email protected]>
Change-Id: Id174bfb28445acbfd12e74e0db4e6ba7930271fe
  • Loading branch information
caolanm committed Jan 27, 2025
1 parent 53999e1 commit a6237d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,15 +888,23 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks(SocketPoll &destPoll, const std
#if !MOBILEAPP
assert(mobileAppDocId == 0 && "Unexpected to have mobileAppDocId in the non-mobile build");

int spawnTimeoutMs = ChildSpawnTimeoutMs / 2;

if (configId.empty() || SubForKitProcs.contains(configId))
{
int numPreSpawn = COOLWSD::NumPreSpawnedChildren;
++numPreSpawn; // Replace the one we'll dispatch just now.
LOG_DBG("getNewChild: Rebalancing children of config[" << configId << "] to " << numPreSpawn);
rebalanceChildren(configId, numPreSpawn);
}
else
{
// configId exists, and no SubForKitProcs for it seen yet, be more generous for startup time.
spawnTimeoutMs = CHILD_SPAWN_TIMEOUT_MS;
LOG_DBG("getNewChild: awaiting subforkit[" << configId << "], timeout of " << spawnTimeoutMs << "ms");
}

const auto timeout = std::chrono::milliseconds(ChildSpawnTimeoutMs / 2);
const auto timeout = std::chrono::milliseconds(spawnTimeoutMs);
LOG_TRC("Waiting for a new child for a max of " << timeout);
#else // MOBILEAPP
const auto timeout = std::chrono::hours(100);
Expand Down

0 comments on commit a6237d5

Please sign in to comment.