MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getSessionTimeout

Function getSessionTimeout

src/Server/GRPCServer.cpp:302–316  ·  view source on GitHub ↗

Gets session's timeout from query info or from the server config.

Source from the content-addressed store, hash-verified

300
301 /// Gets session's timeout from query info or from the server config.
302 std::chrono::steady_clock::duration getSessionTimeout(const GRPCQueryInfo & query_info, const Poco::Util::AbstractConfiguration & config)
303 {
304 auto session_timeout = query_info.session_timeout();
305 if (session_timeout)
306 {
307 auto max_session_timeout = config.getUInt("max_session_timeout", 3600);
308 if (session_timeout > max_session_timeout)
309 throw Exception(ErrorCodes::INVALID_SESSION_TIMEOUT, "Session timeout '{}' is larger than max_session_timeout: {}. "
310 "Maximum session timeout could be modified in configuration file.",
311 std::to_string(session_timeout), std::to_string(max_session_timeout));
312 }
313 else
314 session_timeout = config.getInt("default_session_timeout", 60);
315 return std::chrono::seconds(session_timeout);
316 }
317
318 /// Generates a description of a query by a specified query info.
319 /// This description is used for logging only.

Callers 1

executeQueryMethod · 0.85

Calls 4

ExceptionClass · 0.50
to_stringFunction · 0.50
getUIntMethod · 0.45
getIntMethod · 0.45

Tested by

no test coverage detected