You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The supported operation files under /etc/tedge/operations/c8y should be ideally loaded only once on c8y-mapper startup. However, it is actually loaded many times. This can be explained by tracing how get_operations() functions are called.
let need_cloud_update = self.update_operations(ops_dir.as_std_path())?;
My comments:
(2) is actually redundant. Since already operations get created during init, they should parse to CumulocityConverter.
(3) is most problematic. CumulocityConverter::register_operation() is called by receiving a command registration message. It means, if user has 5 command registration messages, the supported operation directory will be loaded 5 times. I have a doubt if mapper has to load the directory every time when a command registration message arrives.
To Reproduce
Easy check is to use validation for custom operation handler. If the contents of a custom handler is invalid, it logs a warning message. This validation is called inside the get_operations() function.
Describe the bug
The supported operation files under
/etc/tedge/operations/c8y
should be ideally loaded only once on c8y-mapper startup. However, it is actually loaded many times. This can be explained by tracing howget_operations()
functions are called.thin-edge.io/crates/extensions/c8y_mapper_ext/src/converter.rs
Line 1278 in 0866b9b
CumulocityConverter
thin-edge.io/crates/extensions/c8y_mapper_ext/src/converter.rs
Line 216 in 0866b9b
thin-edge.io/crates/extensions/c8y_mapper_ext/src/converter.rs
Line 1400 in 0866b9b
My comments:
(2) is actually redundant. Since already
operations
get created duringinit
, they should parse toCumulocityConverter
.(3) is most problematic.
CumulocityConverter::register_operation()
is called by receiving a command registration message. It means, if user has 5 command registration messages, the supported operation directory will be loaded 5 times. I have a doubt if mapper has to load the directory every time when a command registration message arrives.To Reproduce
Easy check is to use validation for custom operation handler. If the contents of a custom handler is invalid, it logs a warning message. This validation is called inside the
get_operations()
function.Prepare the version of #3144.
Expected behavior
The operation files should be scanned as few times as possible.
Screenshots
Environment (please complete the following information):
1.3.1
Additional context
The directory will be loaded when file change is detected, however, this should be good.
The text was updated successfully, but these errors were encountered: