Terminate watcher if database changes
This commit is contained in:
@@ -26,6 +26,7 @@ private:
|
||||
std::condition_variable cv;
|
||||
std::atomic<bool> should_run;
|
||||
HttpServer &server;
|
||||
DatabaseInstance *watched_database;
|
||||
};
|
||||
} // namespace ui
|
||||
} // namespace duckdb
|
||||
|
||||
@@ -62,6 +62,12 @@ void Watcher::Watch() {
|
||||
break; // DB went away, nothing to watch
|
||||
}
|
||||
|
||||
if (watched_database == nullptr) {
|
||||
watched_database = db.get();
|
||||
} else if (watched_database != db.get()) {
|
||||
break; // DB changed, stop watching, will be restarted
|
||||
}
|
||||
|
||||
duckdb::Connection con{*db};
|
||||
auto polling_interval = GetPollingInterval(*con.context);
|
||||
if (polling_interval == 0) {
|
||||
|
||||
Reference in New Issue
Block a user