Skip to content

Commit 43a459e

Browse files
authored
fix(server): Resest global state on loading error (#5825)
1 parent 4eb6d7b commit 43a459e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server/server_family.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,10 @@ std::optional<fb2::Future<GenericError>> ServerFamily::Load(const std::string& p
13221322
return {};
13231323
}
13241324

1325+
// Reset state on error
1326+
absl::Cleanup reset_state{
1327+
[this]() { service_.SwitchState(GlobalState::LOADING, GlobalState::ACTIVE); }};
1328+
13251329
auto& pool = service_.proactor_pool();
13261330

13271331
const vector<string>& paths = *expand_result;
@@ -1388,6 +1392,7 @@ std::optional<fb2::Future<GenericError>> ServerFamily::Load(const std::string& p
13881392
};
13891393
pool.GetNextProactor()->Dispatch(std::move(load_join_func));
13901394

1395+
std::move(reset_state).Cancel(); // load_join_func resets state after loading
13911396
return future;
13921397
}
13931398

0 commit comments

Comments
 (0)