mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-04 08:21:03 +00:00
TIL: Creating a redis transaction without sending any commands throws an exception
So let's not do that
This commit is contained in:
parent
b637ced1ee
commit
7a138f963c
@ -1540,7 +1540,7 @@ void PostgreSQL::onlineNotification_Redis()
|
|||||||
std::lock_guard<std::mutex> l(_lastOnline_l);
|
std::lock_guard<std::mutex> l(_lastOnline_l);
|
||||||
lastOnline.swap(_lastOnline);
|
lastOnline.swap(_lastOnline);
|
||||||
}
|
}
|
||||||
|
if (!lastOnline.empty()) {
|
||||||
if (_rc->clusterMode) {
|
if (_rc->clusterMode) {
|
||||||
auto tx = _cluster->redis(controllerId).transaction(true);
|
auto tx = _cluster->redis(controllerId).transaction(true);
|
||||||
_doRedisUpdate(tx, controllerId, lastOnline);
|
_doRedisUpdate(tx, controllerId, lastOnline);
|
||||||
@ -1548,7 +1548,7 @@ void PostgreSQL::onlineNotification_Redis()
|
|||||||
auto tx = _redis->transaction(true);
|
auto tx = _redis->transaction(true);
|
||||||
_doRedisUpdate(tx, controllerId, lastOnline);
|
_doRedisUpdate(tx, controllerId, lastOnline);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1557,6 +1557,7 @@ void PostgreSQL::_doRedisUpdate(sw::redis::Transaction &tx, std::string &control
|
|||||||
std::unordered_map< std::pair<uint64_t,uint64_t>,std::pair<int64_t,InetAddress>,_PairHasher > &lastOnline)
|
std::unordered_map< std::pair<uint64_t,uint64_t>,std::pair<int64_t,InetAddress>,_PairHasher > &lastOnline)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "Redis Update\n");
|
||||||
nlohmann::json jtmp1, jtmp2;
|
nlohmann::json jtmp1, jtmp2;
|
||||||
for (auto i=lastOnline.begin(); i != lastOnline.end(); ++i) {
|
for (auto i=lastOnline.begin(); i != lastOnline.end(); ++i) {
|
||||||
uint64_t nwid_i = i->first.first;
|
uint64_t nwid_i = i->first.first;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user