Skip to content

Commit

Permalink
squash w/ startup/shutdown. code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Nov 7, 2024
1 parent 0b08b35 commit cdb6965
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
4 changes: 3 additions & 1 deletion lib/core/include/irods/dns_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ namespace irods::experimental::net::dns_cache
/// \since 5.0.0
auto init_no_create(const std::string_view _shm_name) -> void;

/// TODO
/// Returns the name of the shared memory segment used by the cache.
///
/// This function allows other components and processes to use an existing cache.
///
/// \since 5.0.0
auto shared_memory_name() -> std::string_view;
Expand Down
6 changes: 4 additions & 2 deletions lib/core/include/irods/hostname_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace irods::experimental::net::hostname_cache
/// \since 4.2.9
auto deinit() noexcept -> void;

/// Initializes the dns cache from an existing shared memory object.
/// Initializes the hostname cache from an existing shared memory object.
///
/// This function should only be called on startup of the server.
///
Expand All @@ -37,7 +37,9 @@ namespace irods::experimental::net::hostname_cache
/// \since 5.0.0
auto init_no_create(const std::string_view _shm_name) -> void;

/// TODO
/// Returns the name of the shared memory segment used by the cache.
///
/// This function allows other components and processes to use an existing cache.
///
/// \since 5.0.0
auto shared_memory_name() -> std::string_view;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/irods_server_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace irods
}

config_props_ = json::parse(in);
} // capture
} // init

void server_properties::set_configuration(nlohmann::json _config)
{
Expand Down
19 changes: 8 additions & 11 deletions server/main_server/src/agent_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ auto main(int _argc, char* _argv[]) -> int
path.copy(g_proc_directory.data(), g_proc_directory.size());
}

// Capture the gracefule shutdown timeout value for agent cleanup.
// Capture the graceful shutdown timeout value for agent cleanup.
// This is required so that the signal handler for reaping agents remains async-signal-safe.
{
const auto config_handle{irods::server_properties::instance().map()};
Expand Down Expand Up @@ -363,7 +363,7 @@ auto main(int _argc, char* _argv[]) -> int
}

if (g_terminate_graceful) {
log_af::info("{}: Received shutdown instruction. Exiting agent factory main loop.", __func__);
log_af::info("{}: Received graceful shutdown instruction. Exiting agent factory main loop.", __func__);
break;
}

Expand All @@ -388,7 +388,7 @@ auto main(int _argc, char* _argv[]) -> int
return handle_client_request(newSock, std::time(nullptr));
}
catch (const std::exception& e) {
log_agent::critical("{}: Exception caught in outer most scope of request handler: {}", __func__, e.what());
log_agent::critical("{}: Exception caught in outermost scope of request handler: {}", __func__, e.what());
return 1;
}
}
Expand Down Expand Up @@ -1176,31 +1176,28 @@ namespace

irods::experimental::api::plugin_lifetime_manager::destroy();

// determine if we even need to connect, break the
// infinite reconnect loop.
// Determine if we even need to connect, break the infinite reconnect loop.
if (!resc_mgr.need_maintenance_operations()) {
return status;
}

// find the icat host
// Find the catalog provider host.
rodsServerHost_t* rodsServerHost = 0;
status = getRcatHost(PRIMARY_RCAT, 0, &rodsServerHost);
if (status < 0) {
log_agent::error(ERROR(status, "getRcatHost failed.").result());
return status;
}

// connect to the icat host
// Connect to the catalog provider host.
status = svrToSvrConnect(&_comm, rodsServerHost);
if ( status < 0 ) {
log_agent::error(ERROR(status, "svrToSvrConnect failed.").result());
return status;
}

// call post disconnect maintenance operations before exit
status = resc_mgr.call_maintenance_operations(rodsServerHost->conn);

return status;
// Call post disconnect maintenance operations before exit.
return resc_mgr.call_maintenance_operations(rodsServerHost->conn);
} // agentMain

auto create_agent_pid_file_for_ips(const RsComm& _comm, std::time_t _created_at) -> void
Expand Down

0 comments on commit cdb6965

Please sign in to comment.