mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Use mutex when doing a Store resync
This commit is contained in:
@@ -153,6 +153,9 @@ func (s *Store) setupListener() {
|
||||
|
||||
func (s *Store) resync() {
|
||||
|
||||
// Lock
|
||||
s.mux.Lock()
|
||||
|
||||
// Stringify data
|
||||
newdata, err := json.Marshal(s.data.Interface())
|
||||
if err != nil {
|
||||
@@ -162,6 +165,9 @@ func (s *Store) resync() {
|
||||
}
|
||||
}
|
||||
|
||||
// Lock
|
||||
s.mux.Unlock()
|
||||
|
||||
// Emit event to front end
|
||||
s.runtime.Events.Emit("wails:sync:store:updatedbybackend:"+s.name, string(newdata))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user