#606·gorse

Data race: worker.Sync() and worker.Recommend()

Author: ingosusCreated Dec 26, 2022Updated Aug 22, 2026
Labelsbug

Gorse version Version: unknown-version API version: v0.2.7 Go version: go1.19.3 Git commit: 762f21f3154f35877fe376ba435c11e7eaaf5edc

Describe the bug A data race occurs when the worker configuration is updated. Sync() write w.Config, and Recommend() read.

Perhaps it is better to sync the configuration only between reranking cycles? Because the sync operation is much faster than the calculation of recommendations, as well as changing the configuration parameters during the ranking process can lead to incorrect result.

To Reproduce Test go test -v -race github.com/zhenghaoz/gorse/worker -run TestWorker_SyncRecommend

Expected behavior no data race