Fix race condition and enable race diagnostics

This commit is contained in:
andig 2022-02-13 12:47:19 +01:00
parent 8a4275ce61
commit 9f4148400e
3 changed files with 6 additions and 3 deletions

View file

@ -10,7 +10,7 @@ builds:
- id: evcc
main: main.go
flags:
- -tags=release
- -race -tags=release
ldflags:
- -X github.com/evcc-io/evcc/server.Version={{.Version}} -X github.com/evcc-io/evcc/server.Commit={{.ShortCommit}} -s -w
env:
@ -105,4 +105,4 @@ brews:
<key>StandardErrorPath</key>
<string>#{var}/log/evcc.log</string>
</dict>
</plist>
</plist>

View file

@ -56,7 +56,7 @@ test:
build:
@echo Version: $(VERSION) $(BUILD_DATE)
go build -v $(BUILD_TAGS) $(BUILD_ARGS)
go build -race -v $(BUILD_TAGS) $(BUILD_ARGS)
release-test:
goreleaser --snapshot --skip-publish --rm-dist

View file

@ -1281,7 +1281,10 @@ func (lp *LoadPoint) updateChargePower() {
return err
}
lp.Lock()
lp.chargePower = value // update value if no error
lp.Unlock()
lp.log.DEBUG.Printf("charge power: %.0fW", value)
lp.publish("chargePower", value)