Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0962fe3
Add performance checks to clang-tidy config
hikinggrass Dec 10, 2024
3f76a88
Log module startup time for JavaScript and Python modules as well
hikinggrass Dec 10, 2024
2b17dfb
Use const ref for a few more variables and parameters
hikinggrass Dec 10, 2024
f5d4333
Remove serialize function from config
hikinggrass Dec 10, 2024
9d4da56
Refactor schema loading and validation
hikinggrass Dec 10, 2024
9d5496c
Ad some moves that clang-tidy suggested
hikinggrass Dec 10, 2024
a93bdfa
Directly pass the active_modules part of a config to the parse function
hikinggrass Dec 10, 2024
c74055b
Improve yaml file loading performance by reserving the appropriate am…
hikinggrass Dec 10, 2024
b8385de
Log the number of modules started
hikinggrass Dec 10, 2024
0bc601b
Fix narrowing conversion warning in yaml error handler by claming max…
hikinggrass Dec 10, 2024
bb1c2de
Fix widening conversion warning by multiplying two std::size_t already
hikinggrass Dec 10, 2024
0acb24f
Bump version to 0.19.2
hikinggrass Dec 10, 2024
9ddb9ce
Only publish module_names (a mapping of module type to id) once and r…
hikinggrass Dec 11, 2024
d40f7c3
Publish manifest individually
hikinggrass Dec 11, 2024
dbd4dc2
async get() function for MQTT used in get_module_config
hikinggrass Dec 12, 2024
1077b00
Fix everestjs config parsing with new config entry format
hikinggrass Dec 16, 2024
250ee4a
Capturing more vars as refs
hikinggrass Dec 16, 2024
5551fed
Log which topic cause a timeout exception in get()
hikinggrass Dec 16, 2024
c2f2f60
Use get_with_timeout in get_module_config
hikinggrass Dec 18, 2024
b96933b
Fix usage of MQTTSettings uses socket in manager
hikinggrass Dec 18, 2024
e6bf11c
Use get_module_name instead of get_module_info if only the module nam…
hikinggrass Dec 18, 2024
5d63f80
More const ref usage
hikinggrass Dec 18, 2024
04ec269
Re-order config handler in manager
hikinggrass Dec 21, 2024
4b6d16e
everestpy: initialize logging in module ctor not RuntimeSession
hikinggrass Dec 21, 2024
ed5152e
everestpy: add new RuntimeSession ctor that accepts MQTTSettings and …
hikinggrass Dec 21, 2024
30cf7e2
everestpy: add short documentation comments and deprecated RuntimeSes…
hikinggrass Dec 21, 2024
9a90570
More constref and move usage
hikinggrass Dec 21, 2024
c4737e3
Add --retain-topics flag to manager to keep retained topics after sta…
hikinggrass Dec 21, 2024
61603c9
Remove old cleanup_retained_topics functions since this is now provid…
hikinggrass Dec 21, 2024
6c19fb4
clang-format
hikinggrass Dec 21, 2024
6405e8e
Erase MessageHandler for topics without any registered handlers
hikinggrass Jan 2, 2025
7c539ac
Use .at() instead of [] for map access
hikinggrass Jan 2, 2025
1e4f79e
Exit early with EXIT_FAILURE if there are no modules to start
hikinggrass Jan 3, 2025
64e9ae2
Merge remote-tracking branch 'origin/main' into feature/performance-i…
hikinggrass Jan 3, 2025
9b68f6d
Make logged duration of get_module_config less verbose
hikinggrass Jan 6, 2025
abad2b8
Remove redundant unique_ptrs in Validators struct
hikinggrass Jan 7, 2025
3814cdd
Turn load_schema and load_schemas into free functions
hikinggrass Jan 7, 2025
ad1ecda
Move get and get_async from MQTTAbstraction to module config since it…
hikinggrass Jan 7, 2025
96835c0
load_schema and load_schemas: clang-format
hikinggrass Jan 7, 2025
b42680a
Revert to old file loading code for redability reasons
hikinggrass Jan 7, 2025
560c5ab
Merge remote-tracking branch 'origin/main' into feature/performance-i…
hikinggrass Jan 7, 2025
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 everestpy/src/everest/everestpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ PYBIND11_MODULE(everestpy, m) {
.def(py::init<const std::string&, const RuntimeSession&>())
.def("say_hello", &Module::say_hello)
.def("init_done", py::overload_cast<>(&Module::init_done))
.def("init_done", py::overload_cast<std::function<void()>>(&Module::init_done))
.def("init_done", py::overload_cast<const std::function<void()>&>(&Module::init_done))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a matter of taste. I'm just wondering if now any appearance of any std::function will be passed by reference instead of value?

.def("call_command", &Module::call_command)
.def("publish_variable", &Module::publish_variable)
.def("implement_command", &Module::implement_command)
Expand Down
2 changes: 1 addition & 1 deletion everestpy/src/everest/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
std::unique_ptr<Everest::Everest>
Module::create_everest_instance(const std::string& module_id, const Everest::Config& config,
const Everest::RuntimeSettings& rs,
std::shared_ptr<Everest::MQTTAbstraction> mqtt_abstraction) {
const std::shared_ptr<Everest::MQTTAbstraction>& mqtt_abstraction) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A constant reference to a shared pointer is almost the same as the pointer itself. Everest::MQTTAbstraction& would be the better choice here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would have probably been fine because Module will outlive Everest, but I've reverted the change in #227

return std::make_unique<Everest::Everest>(module_id, config, rs.validate_schema, mqtt_abstraction,
rs.telemetry_prefix, rs.telemetry_enabled);
}
Expand Down
6 changes: 3 additions & 3 deletions everestpy/src/everest/module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class Module {

ModuleSetup say_hello();

void init_done(std::function<void()> on_ready_handler) {
void init_done(const std::function<void()>& on_ready_handler) {
this->handle->check_code();

if (on_ready_handler) {
handle->register_on_ready_handler(std::move(on_ready_handler));
handle->register_on_ready_handler(on_ready_handler);
}

const auto end_time = std::chrono::system_clock::now();
Expand Down Expand Up @@ -101,7 +101,7 @@ class Module {
static std::unique_ptr<Everest::Everest>
create_everest_instance(const std::string& module_id, const Everest::Config& config,
const Everest::RuntimeSettings& rs,
std::shared_ptr<Everest::MQTTAbstraction> mqtt_abstraction);
const std::shared_ptr<Everest::MQTTAbstraction>& mqtt_abstraction);

ModuleInfo module_info{};
std::map<std::string, Interface> requirements;
Expand Down
6 changes: 3 additions & 3 deletions include/framework/everest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct ErrorFactory;
class Everest {
public:
Everest(std::string module_id, const Config& config, bool validate_data_with_schema,
std::shared_ptr<MQTTAbstraction> mqtt_abstraction, const std::string& telemetry_prefix,
const std::shared_ptr<MQTTAbstraction>& mqtt_abstraction, const std::string& telemetry_prefix,
bool telemetry_enabled);

// forbid copy assignment and copy construction
Expand All @@ -66,7 +66,7 @@ class Everest {
///
/// \brief Allows a module to indicate that it provides the given command \p cmd
///
void provide_cmd(const std::string impl_id, const std::string cmd_name, const JsonCommand handler);
void provide_cmd(const std::string& impl_id, const std::string cmd_name, const JsonCommand& handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why const ref'ing only impl_id and not cmd_name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #227

void provide_cmd(const cmd& cmd);

///
Expand Down Expand Up @@ -217,7 +217,7 @@ class Everest {
bool telemetry_enabled;
std::optional<ModuleTierMappings> module_tier_mappings;

void handle_ready(nlohmann::json data);
void handle_ready(const nlohmann::json& data);

void heartbeat();

Expand Down
2 changes: 1 addition & 1 deletion include/framework/runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class ModuleLoader {
explicit ModuleLoader(int argc, char* argv[], ModuleCallbacks callbacks) :
ModuleLoader(argc, argv, callbacks, {"undefined project", "undefined version", "undefined git version"}){};
explicit ModuleLoader(int argc, char* argv[], ModuleCallbacks callbacks,
const VersionInformation version_information);
const VersionInformation& version_information);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should potentially passed by value, as this information is probably only moved to the ModuleLoader.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #227


int initialize();
};
Expand Down
4 changes: 2 additions & 2 deletions include/utils/message_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ class MessageHandler {
void stop();

/// \brief Adds a \p handler that will receive messages from the queue.
void add_handler(std::shared_ptr<TypedHandler> handler);
void add_handler(const std::shared_ptr<TypedHandler>& handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment above - I think this might not be a good choice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed this (by reverting the change and blocking the suggestion of adding const ref to shared_ptr args) in #227
I think this was changed by me just because I wasn't paying too close attention to the recommendation of clang-tidy here


/// \brief Removes a specific \p handler
void remove_handler(std::shared_ptr<TypedHandler> handler);
void remove_handler(const std::shared_ptr<TypedHandler>& handler);

/// \brief \returns the number of registered handlers
std::size_t count_handlers();
Expand Down
2 changes: 1 addition & 1 deletion include/utils/module_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Everest {
/// \brief get config from manager via mqtt
nlohmann::json get_module_config(std::shared_ptr<MQTTAbstraction> mqtt, const std::string& module_id);
nlohmann::json get_module_config(const std::shared_ptr<MQTTAbstraction>& mqtt, const std::string& module_id);
} // namespace Everest

#endif // UTILS_MODULE_CONFIG_HPP
4 changes: 2 additions & 2 deletions include/utils/mqtt_abstraction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class MQTTAbstraction {
std::shared_future<void> get_main_loop_future();

///
/// \copydoc MQTTAbstractionImpl::register_handler(const std::string&, std::shared_ptr<TypedHandler>, QOS)
void register_handler(const std::string& topic, std::shared_ptr<TypedHandler> handler, QOS qos);
/// \copydoc MQTTAbstractionImpl::register_handler(const std::string&, const std::shared_ptr<TypedHandler>&, QOS)
void register_handler(const std::string& topic, const std::shared_ptr<TypedHandler>& handler, QOS qos);

///
/// \copydoc MQTTAbstractionImpl::unregister_handler(const std::string&, const Token&)
Expand Down
2 changes: 1 addition & 1 deletion include/utils/mqtt_abstraction_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MQTTAbstractionImpl {
///
/// \brief subscribes to the given \p topic and registers a callback \p handler that is called when a message
/// arrives on the topic. With \p qos a MQTT Quality of Service level can be set.
void register_handler(const std::string& topic, std::shared_ptr<TypedHandler> handler, QOS qos);
void register_handler(const std::string& topic, const std::shared_ptr<TypedHandler>& handler, QOS qos);

///
/// \brief unsubscribes a handler identified by its \p token from the given \p topic
Expand Down
14 changes: 7 additions & 7 deletions lib/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ static ParsedConfigMap parse_config_map(const json& config_map_schema, const jso

// validate each config entry
for (const auto& config_entry_el : config_map_schema.items()) {
const std::string config_entry_name = config_entry_el.key();
const json config_entry = config_entry_el.value();
const std::string& config_entry_name = config_entry_el.key();
const json& config_entry = config_entry_el.value();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto&


// only convenience exception, would be catched by schema validation below if not thrown here
if (!config_entry.contains("default") and !config_map.contains(config_entry_name)) {
Expand Down Expand Up @@ -125,7 +125,7 @@ static auto get_provides_for_probe_module(const std::string& probe_module_id, co
const auto& connections = module_config.value("connections", json::object());

for (const auto& connection : connections.items()) {
const std::string req_id = connection.key();
const std::string& req_id = connection.key();
const std::string module_name = module_config.at("module");
const auto& module_manifest = manifests.at(module_name);

Expand Down Expand Up @@ -161,7 +161,7 @@ static auto get_provides_for_probe_module(const std::string& probe_module_id, co

static auto get_requirements_for_probe_module(const std::string& probe_module_id, const json& config,
const json& manifests) {
const auto probe_module_config = config.at(probe_module_id);
const auto& probe_module_config = config.at(probe_module_id);

auto requirements = json::object();

Expand Down Expand Up @@ -579,7 +579,7 @@ void ManagerConfig::load_and_validate_manifest(const std::string& module_id, con

// validate config for !module
{
const json config_map = module_config.at("config_module");
const json& config_map = module_config.at("config_module");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto&

const json config_map_schema = this->manifests[module_config.at("module").get<std::string>()]["config"];

try {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ ModuleConfigs Config::get_module_configs(const std::string& module_id) const {
for (const auto& entry : conf_map.value().items()) {
const json entry_type = config_schema.at(entry.key()).at("type");
ConfigEntry value;
const json data = entry.value();
const json& data = entry.value();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto&


if (data.is_string()) {
value = data.get<std::string>();
Expand Down Expand Up @@ -1239,7 +1239,7 @@ void Config::ref_loader(const json_uri& uri, json& schema) {
schema = nlohmann::json_schema::draft7_schema_builtin;
return;
} else {
const auto path = uri.path();
const auto& path = uri.path();
if (this->types.contains(path)) {
schema = this->types[path];
EVLOG_verbose << fmt::format("ref path \"{}\" schema has been found.", path);
Expand Down
21 changes: 11 additions & 10 deletions lib/everest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const auto remote_cmd_res_timeout_seconds = 300;
const std::array<std::string, 3> TELEMETRY_RESERVED_KEYS = {{"connector_id"}};

Everest::Everest(std::string module_id_, const Config& config_, bool validate_data_with_schema,
std::shared_ptr<MQTTAbstraction> mqtt_abstraction, const std::string& telemetry_prefix,
const std::shared_ptr<MQTTAbstraction>& mqtt_abstraction, const std::string& telemetry_prefix,
bool telemetry_enabled) :
mqtt_abstraction(mqtt_abstraction),
config(config_),
Expand Down Expand Up @@ -71,7 +71,8 @@ Everest::Everest(std::string module_id_, const Config& config_, bool validate_da
// setup error_manager_req_global if enabled + error_database + error_state_monitor
if (this->module_manifest.contains("enable_global_errors") &&
this->module_manifest.at("enable_global_errors").get<bool>()) {
std::shared_ptr<error::ErrorDatabaseMap> global_error_database = std::make_shared<error::ErrorDatabaseMap>();
const std::shared_ptr<error::ErrorDatabaseMap>& global_error_database =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto&

std::make_shared<error::ErrorDatabaseMap>();
const error::ErrorManagerReqGlobal::SubscribeGlobalAllErrorsFunc subscribe_global_all_errors_func =
[this](const error::ErrorCallback& callback, const error::ErrorCallback& clear_callback) {
this->subscribe_global_all_errors(callback, clear_callback);
Expand All @@ -90,7 +91,7 @@ Everest::Everest(std::string module_id_, const Config& config_, bool validate_da
// setup error_managers, error_state_monitors, error_factories and error_databases for all implementations
for (const std::string& impl : Config::keys(this->module_manifest.at("provides"))) {
// setup shared database
std::shared_ptr<error::ErrorDatabaseMap> error_database = std::make_shared<error::ErrorDatabaseMap>();
const std::shared_ptr<error::ErrorDatabaseMap> error_database = std::make_shared<error::ErrorDatabaseMap>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto&


// setup error manager
const std::string interface_name = this->module_manifest.at("provides").at(impl).at("interface");
Expand Down Expand Up @@ -188,7 +189,7 @@ Everest::Everest(std::string module_id_, const Config& config_, bool validate_da
}

// register handler for global ready signal
const auto handle_ready_wrapper = [this](const std::string&, json data) { this->handle_ready(data); };
const auto handle_ready_wrapper = [this](const std::string&, const json& data) { this->handle_ready(data); };
const auto everest_ready =
std::make_shared<TypedHandler>(HandlerType::ExternalMQTT, std::make_shared<Handler>(handle_ready_wrapper));
this->mqtt_abstraction->register_handler(fmt::format("{}ready", mqtt_everest_prefix), everest_ready, QOS::QOS2);
Expand Down Expand Up @@ -265,7 +266,7 @@ void Everest::check_code() {
this->config.get_manifests()[this->config.get_main_config()[this->module_id]["module"].get<std::string>()];
for (const auto& element : module_manifest.at("provides").items()) {
const auto& impl_id = element.key();
const auto impl_manifest = element.value();
const auto& impl_manifest = element.value();
const auto interface_definition = this->config.get_interface_definition(impl_manifest.at("interface"));

std::set<std::string> cmds_not_registered;
Expand Down Expand Up @@ -666,13 +667,13 @@ void Everest::subscribe_global_all_errors(const error::ErrorCallback& callback,
for (const auto& [module_id, module_name] : this->config.get_module_names()) {
const json provides = this->config.get_manifests().at(module_name).at("provides");
for (const auto& impl : provides.items()) {
const std::string impl_id = impl.key();
const std::string& impl_id = impl.key();
const std::string interface = impl.value().at("interface");
const json errors = this->config.get_interface_definition(interface).at("errors");
for (const auto& error_namespace_it : errors.items()) {
const std::string error_type_namespace = error_namespace_it.key();
const std::string& error_type_namespace = error_namespace_it.key();
for (const auto& error_name_it : error_namespace_it.value().items()) {
const std::string error_type_name = error_name_it.key();
const std::string& error_type_name = error_name_it.key();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 4 nested for loops here, I would appreciate, that if places like these get touched, that they get refactored or a FIXME gets added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gets refactored in #225

const std::string raise_topic =
fmt::format("{}/error/{}/{}", this->config.mqtt_prefix(module_id, impl_id),
error_type_namespace, error_type_name);
Expand Down Expand Up @@ -784,7 +785,7 @@ void Everest::signal_ready() {
/// \brief Ready handler for global readyness (e.g. all modules are ready now).
/// This will called when receiving the global ready signal from manager.
///
void Everest::handle_ready(json data) {
void Everest::handle_ready(const json& data) {
BOOST_LOG_FUNCTION();

EVLOG_debug << fmt::format("handle_ready: {}", data.dump());
Expand Down Expand Up @@ -818,7 +819,7 @@ void Everest::handle_ready(json data) {
// this->heartbeat_thread = std::thread(&Everest::heartbeat, this);
}

void Everest::provide_cmd(const std::string impl_id, const std::string cmd_name, const JsonCommand handler) {
void Everest::provide_cmd(const std::string& impl_id, const std::string cmd_name, const JsonCommand& handler) {
BOOST_LOG_FUNCTION();

// extract manifest definition of this command
Expand Down
6 changes: 3 additions & 3 deletions lib/message_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ MessageHandler::MessageHandler() : running(true) {
std::vector<std::shared_ptr<TypedHandler>> local_handlers;
{
const std::lock_guard<std::mutex> handlers_lock(handler_list_mutex);
for (auto handler : this->handlers) {
for (const auto& handler : this->handlers) {
local_handlers.push_back(handler);
}
Comment on lines +73 to 75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be local_handlers = this->handlers; be enough?

}
Expand Down Expand Up @@ -129,14 +129,14 @@ void MessageHandler::stop() {
this->cv.notify_all();
}

void MessageHandler::add_handler(std::shared_ptr<TypedHandler> handler) {
void MessageHandler::add_handler(const std::shared_ptr<TypedHandler>& handler) {
{
const std::lock_guard<std::mutex> lock(this->handler_list_mutex);
this->handlers.insert(handler);
}
}

void MessageHandler::remove_handler(std::shared_ptr<TypedHandler> handler) {
void MessageHandler::remove_handler(const std::shared_ptr<TypedHandler>& handler) {
{
const std::lock_guard<std::mutex> lock(this->handler_list_mutex);
auto it = std::find(this->handlers.begin(), this->handlers.end(), handler);
Expand Down
2 changes: 1 addition & 1 deletion lib/module_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using json = nlohmann::json;

inline constexpr int mqtt_get_config_timeout_ms = 5000;

json get_module_config(std::shared_ptr<MQTTAbstraction> mqtt, const std::string& module_id) {
json get_module_config(const std::shared_ptr<MQTTAbstraction>& mqtt, const std::string& module_id) {
const auto& everest_prefix = mqtt->get_everest_prefix();

const auto get_config_topic = fmt::format("{}modules/{}/get_config", everest_prefix, module_id);
Expand Down
3 changes: 2 additions & 1 deletion lib/mqtt_abstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ std::shared_future<void> MQTTAbstraction::get_main_loop_future() {
return mqtt_abstraction->get_main_loop_future();
}

void MQTTAbstraction::register_handler(const std::string& topic, std::shared_ptr<TypedHandler> handler, QOS qos) {
void MQTTAbstraction::register_handler(const std::string& topic, const std::shared_ptr<TypedHandler>& handler,
QOS qos) {
BOOST_LOG_FUNCTION();
mqtt_abstraction->register_handler(topic, handler, qos);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/mqtt_abstraction_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ void MQTTAbstractionImpl::on_mqtt_disconnect() {
EVLOG_AND_THROW(EverestInternalError("Lost connection to MQTT broker"));
}

void MQTTAbstractionImpl::register_handler(const std::string& topic, std::shared_ptr<TypedHandler> handler, QOS qos) {
void MQTTAbstractionImpl::register_handler(const std::string& topic, const std::shared_ptr<TypedHandler>& handler,
QOS qos) {
BOOST_LOG_FUNCTION();

switch (handler->type) {
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ ModuleCallbacks::ModuleCallbacks(
}

ModuleLoader::ModuleLoader(int argc, char* argv[], ModuleCallbacks callbacks,
const VersionInformation version_information) :
const VersionInformation& version_information) :
runtime_settings(nullptr), callbacks(callbacks), version_information(version_information) {
if (!this->parse_command_line(argc, argv)) {
this->should_exit = true;
Expand Down
6 changes: 3 additions & 3 deletions src/controller/command_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ nlohmann::json CommandApi::handle(const std::string& cmd, const json& params) {
if (cmd == "get_modules") {
auto modules_list = json::object();

for (const auto item : fs::directory_iterator(this->config.module_dir)) {
for (const auto& item : fs::directory_iterator(this->config.module_dir)) {
if (!fs::is_directory(item)) {
continue;
}
Expand All @@ -48,7 +48,7 @@ nlohmann::json CommandApi::handle(const std::string& cmd, const json& params) {
} else if (cmd == "get_configs") {
auto config_list = json::object();

for (const auto item : fs::directory_iterator(this->config.configs_dir)) {
for (const auto& item : fs::directory_iterator(this->config.configs_dir)) {
if (!fs::is_regular_file(item)) {
continue;
}
Expand All @@ -65,7 +65,7 @@ nlohmann::json CommandApi::handle(const std::string& cmd, const json& params) {
} else if (cmd == "get_interfaces") {
auto interface_list = json::object();

for (const auto item : fs::directory_iterator(this->config.interface_dir)) {
for (const auto& item : fs::directory_iterator(this->config.interface_dir)) {

if (!fs::is_regular_file(item)) {
continue;
Expand Down
Loading