Suppress empty query modules directory errors

Reviewers: llugovic, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2771
This commit is contained in:
Matej Ferencevic 2020-05-20 16:54:24 +02:00
parent b510ac1049
commit 1a8ae7f9c2

View File

@ -437,6 +437,7 @@ void ModuleRegistry::SetModulesDirectory(
}
bool ModuleRegistry::LoadOrReloadModuleFromName(const std::string_view &name) {
if (modules_dir_.empty()) return false;
if (name.empty()) return false;
std::unique_lock<utils::RWLock> guard(lock_);
auto found_it = modules_.find(name);
@ -462,6 +463,7 @@ bool ModuleRegistry::LoadOrReloadModuleFromName(const std::string_view &name) {
}
void ModuleRegistry::UnloadAndLoadModulesFromDirectory() {
if (modules_dir_.empty()) return;
if (!utils::DirExists(modules_dir_)) {
LOG(ERROR) << "Module directory " << modules_dir_ << " doesn't exist";
return;