Skip to content

Commit

Permalink
refactor and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Jan 2, 2025
1 parent 48121a9 commit ee057a3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/client/replication_ddl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,18 +1396,22 @@ void replication_ddl_client::end_meta_request(const rpc_response_task_ptr &callb
dsn::error_code replication_ddl_client::get_app_envs(const std::string &app_name,
std::map<std::string, std::string> &envs)
{
// Just match the table with the provided name exactly since we want to get the envs from
// a specific table.
std::vector<::dsn::app_info> apps;
const auto &result = list_apps(
dsn::app_status::AS_AVAILABLE, app_name, utils::pattern_match_type::PMT_MATCH_EXACT, apps);
if (!result) {
return result.code();
}

for (auto &app : apps) {
if (app.app_name == app_name) {
envs = app.envs;
return dsn::ERR_OK;
for (const auto &app : apps) {
if (app.app_name != app_name) {
continue;
}

envs = app.envs;
return dsn::ERR_OK;
}

return dsn::ERR_OBJECT_NOT_FOUND;
Expand Down

0 comments on commit ee057a3

Please sign in to comment.