Make polling interval configurable
This commit is contained in:
@@ -288,8 +288,13 @@ void HttpServer::Watch() {
|
||||
break; // DB went away, nothing to watch
|
||||
}
|
||||
|
||||
duckdb::Connection con{*db};
|
||||
auto polling_interval = GetPollingInterval(*con.context);
|
||||
if (polling_interval == 0) {
|
||||
return; // Disable watcher
|
||||
}
|
||||
|
||||
try {
|
||||
duckdb::Connection con{*db};
|
||||
if (WasCatalogUpdated(*db, con, last_state)) {
|
||||
SendCatalogChangedEvent();
|
||||
}
|
||||
@@ -304,10 +309,10 @@ void HttpServer::Watch() {
|
||||
std::cerr << "Will now terminate." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(watcher_mutex);
|
||||
watcher_cv.wait_for(lock,
|
||||
std::chrono::milliseconds(2000)); // TODO - configure
|
||||
watcher_cv.wait_for(lock, std::chrono::milliseconds(polling_interval));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,14 @@ static void LoadInternal(DatabaseInstance &instance) {
|
||||
LogicalType::VARCHAR, Value(def));
|
||||
}
|
||||
|
||||
{
|
||||
auto def = GetEnvOrDefaultInt(UI_POLLING_INTERVAL_SETTING_NAME, 284);
|
||||
config.AddExtensionOption(
|
||||
UI_POLLING_INTERVAL_SETTING_NAME,
|
||||
"Period of time between UI polling requests (in ms)",
|
||||
LogicalType::UINTEGER, Value::UINTEGER(def));
|
||||
}
|
||||
|
||||
RESISTER_TF("start_ui", StartUIFunction);
|
||||
RESISTER_TF("start_ui_server", StartUIServerFunction);
|
||||
RESISTER_TF("stop_ui_server", StopUIServerFunction);
|
||||
|
||||
Reference in New Issue
Block a user