Add comment to updateFieldIfChanged.
This commit is contained in:
parent
7aef001778
commit
a72897655b
1 changed files with 1 additions and 0 deletions
1
main.go
1
main.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue