Add comment to updateFieldIfChanged.

This commit is contained in:
Pieter Hollander 2024-02-20 16:52:09 +01:00
parent 7aef001778
commit a72897655b
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -148,6 +148,7 @@ func createLoggerWithLevel(level slog.Level) *slog.Logger {
}))
}
// updateFieldIfChanged ensures that meter readings that haven't been updated aren't written to the database, in order to save storage space.
func updateFieldIfChanged(currentValue *int, previousValue *int) (*int, bool) {
if currentValue != nil && *currentValue == *previousValue {
return nil, false // No change