chore: made pqxx statically linked
This commit is contained in:
@@ -14,6 +14,7 @@ file(GLOB FILES
|
||||
src/network/*.cpp
|
||||
)
|
||||
|
||||
find_package(libpqxx CONFIG REQUIRED)
|
||||
add_library(tw_server_lib STATIC ${FILES})
|
||||
|
||||
target_include_directories(tw_server_lib
|
||||
@@ -23,7 +24,7 @@ target_include_directories(tw_server_lib
|
||||
|
||||
target_link_libraries(tw_server_lib
|
||||
PUBLIC
|
||||
towards
|
||||
tw_common
|
||||
tw::io
|
||||
tw::network
|
||||
tw::protocol
|
||||
@@ -35,10 +36,8 @@ target_link_libraries(tw_server_lib
|
||||
Jolt
|
||||
protobuf::libprotobuf
|
||||
${Boost_LIBRARIES}
|
||||
${LIBDECOR_LIB}
|
||||
Tracy::TracyClient
|
||||
pqxx
|
||||
pq
|
||||
libpqxx::pqxx
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/server.cpp)
|
||||
|
||||
@@ -7,7 +7,7 @@ TimescaleDbMetricsReporter::TimescaleDbMetricsReporter(const TimescaleDbConfigur
|
||||
m_last_flush_time(std::chrono::steady_clock::now())
|
||||
{
|
||||
try {
|
||||
m_connection = pqxx::connection(config.connection.to_string());
|
||||
m_connection.emplace(config.connection.to_string());
|
||||
spdlog::info("Connected to TimescaleDB at {}:{}", config.connection.host, config.connection.port);
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("Failed to connect to TimescaleDB: {}", e.what());
|
||||
@@ -23,9 +23,9 @@ void TimescaleDbMetricsReporter::flush() {
|
||||
pqxx::work tx{*m_connection};
|
||||
|
||||
const auto table = m_connection->quote_name(m_metrics_table);
|
||||
tx.exec("INSERT INTO " + table + " (time, outbound, inbound, player_count) VALUES (NOW(), $1, $2, $3)",
|
||||
pqxx::params(m_outbound_bucket, m_inbound_bucket, m_player_count))
|
||||
.no_rows();
|
||||
tx.exec_prepared("INSERT INTO " + table + " (time, outbound, inbound, player_count) VALUES (NOW(), $1, $2, $3)",
|
||||
m_outbound_bucket, m_inbound_bucket, m_player_count)
|
||||
.empty();
|
||||
tx.commit();
|
||||
|
||||
TracyPlot("outbound", (int64_t)m_outbound_bucket);
|
||||
|
||||
Reference in New Issue
Block a user