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

Function getSessionTimeout

src/Server/GRPCServer.cpp:183–198  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

181
182 /// Gets session's timeout from query info or from the server config.
183 size_t getSessionTimeout(const GRPCQueryInfo & query_info, const Poco::Util::AbstractConfiguration & config)
184 {
185 auto session_timeout = query_info.session_timeout();
186 if (session_timeout)
187 {
188 auto max_session_timeout = config.getUInt("max_session_timeout", 3600);
189 if (session_timeout > max_session_timeout)
190 throw Exception(ErrorCodes::INVALID_SESSION_TIMEOUT,
191 "Session timeout '{}' is larger than max_session_timeout: {}. Maximum session timeout could be modified in configuration file.",
192 session_timeout, max_session_timeout);
193 }
194 else
195 session_timeout = config.getInt("default_session_timeout", 60);
196
197 return session_timeout;
198 }
199
200 /// Generates a description of a query by a specified query info.
201 /// This description is used for logging only.

Callers 1

executeQueryMethod · 0.85

Calls 3

ExceptionClass · 0.50
getUIntMethod · 0.45
getIntMethod · 0.45

Tested by

no test coverage detected