mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-16 12:06:55 +02:00
update controller db record
This commit is contained in:
parent
64b7f8e445
commit
9de863e68b
1 changed files with 3 additions and 2 deletions
|
@ -968,15 +968,16 @@ void PostgreSQL::heartbeat()
|
|||
std::string now = std::to_string(ts);
|
||||
std::string host_port = std::to_string(_listenPort);
|
||||
std::string use_redis = (_rc != NULL) ? "true" : "false";
|
||||
std::string redis_mem_status = (_redisMemberStatus) ? "true" : "false";
|
||||
|
||||
try {
|
||||
pqxx::result res = w.exec0("INSERT INTO ztc_controller (id, cluster_host, last_alive, public_identity, v_major, v_minor, v_rev, v_build, host_port, use_redis) "
|
||||
"VALUES ("+w.quote(controllerId)+", "+w.quote(hostname)+", TO_TIMESTAMP("+now+"::double precision/1000), "+
|
||||
w.quote(publicIdentity)+", "+major+", "+minor+", "+rev+", "+build+", "+host_port+", "+use_redis+") "
|
||||
w.quote(publicIdentity)+", "+major+", "+minor+", "+rev+", "+build+", "+host_port+", "+use_redis+", "+redis_mem_status+") "
|
||||
"ON CONFLICT (id) DO UPDATE SET cluster_host = EXCLUDED.cluster_host, last_alive = EXCLUDED.last_alive, "
|
||||
"public_identity = EXCLUDED.public_identity, v_major = EXCLUDED.v_major, v_minor = EXCLUDED.v_minor, "
|
||||
"v_rev = EXCLUDED.v_rev, v_build = EXCLUDED.v_rev, host_port = EXCLUDED.host_port, "
|
||||
"use_redis = EXCLUDED.use_redis");
|
||||
"use_redis = EXCLUDED.use_redis, redis_member_status = EXCLUDED.redis_member_status");
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr, "Heartbeat update failed: %s\n", e.what());
|
||||
w.abort();
|
||||
|
|
Loading…
Add table
Reference in a new issue