Merge pull request #15 from duckdb/jray/fix-null-watcher-error
fix null watcher error
This commit is contained in:
@@ -41,10 +41,18 @@ void HttpServer::UpdateDatabaseInstance(
|
|||||||
shared_ptr<DatabaseInstance> context_db) {
|
shared_ptr<DatabaseInstance> context_db) {
|
||||||
const auto current_db = server_instance->LockDatabaseInstance();
|
const auto current_db = server_instance->LockDatabaseInstance();
|
||||||
if (current_db != context_db) {
|
if (current_db != context_db) {
|
||||||
|
auto watcher_stopped = false;
|
||||||
|
if (server_instance->watcher) {
|
||||||
server_instance->watcher->Stop();
|
server_instance->watcher->Stop();
|
||||||
|
server_instance->watcher = nullptr;
|
||||||
|
watcher_stopped = true;
|
||||||
|
}
|
||||||
server_instance->ddb_instance = context_db;
|
server_instance->ddb_instance = context_db;
|
||||||
|
if (watcher_stopped) {
|
||||||
|
server_instance->watcher = make_uniq<Watcher>(*this);
|
||||||
server_instance->watcher->Start();
|
server_instance->watcher->Start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HttpServer::Started() {
|
bool HttpServer::Started() {
|
||||||
|
|||||||
Reference in New Issue
Block a user