mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
zkutil: Probably fixed crashing on ZK connection loss. [#METR-10202]
This commit is contained in:
parent
63cff6a5a4
commit
e0d2bce6e2
@ -13,10 +13,20 @@ typedef std::promise<WatchEventInfo> WatchPromise;
|
||||
struct WatchWithPromise : public zk::Watch
|
||||
{
|
||||
WatchPromise promise;
|
||||
bool notified;
|
||||
|
||||
WatchWithPromise() : notified(false) {}
|
||||
|
||||
void process(WatchEvent::type event, SessionState::type state, const std::string & path)
|
||||
{
|
||||
if (notified)
|
||||
{
|
||||
LOG_WARNING(&Logger::get("WatchWithPromise"), "Ignoring event " << WatchEvent::toString(event) << " with state "
|
||||
<< SessionState::toString(state) << " for path " << path);
|
||||
return;
|
||||
}
|
||||
promise.set_value(WatchEventInfo(event, state, path));
|
||||
notified = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user