Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/utils/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace duckdb {
typedef std::string (*simple_tf_t)(ClientContext &);

struct RunOnceTableFunctionState : GlobalTableFunctionState {
RunOnceTableFunctionState() : run(false) {};
RunOnceTableFunctionState() : run(false){};
std::atomic<bool> run;

static unique_ptr<GlobalTableFunctionState> Init(ClientContext &,
Expand Down
1 change: 1 addition & 0 deletions src/include/watcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Watcher {
std::condition_variable cv;
std::atomic<bool> should_run;
HttpServer &server;
DatabaseInstance *watched_database;
};
} // namespace ui
} // namespace duckdb
9 changes: 8 additions & 1 deletion src/watcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
namespace duckdb {
namespace ui {

Watcher::Watcher(HttpServer &_server) : should_run(false), server(_server) {}
Watcher::Watcher(HttpServer &_server)
: should_run(false), server(_server), watched_database(nullptr) {}

bool WasCatalogUpdated(DatabaseInstance &db, Connection &connection,
CatalogState &last_state) {
Expand Down Expand Up @@ -62,6 +63,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) {
Expand Down
3 changes: 2 additions & 1 deletion test/sql/ui.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# name: test/sql/ui.test
# description: test ui extension
# group: [ui]
# group: [sql]

Loading