mirror of
https://github.com/garraflavatra/rolens.git
synced 2024-11-22 10:25:48 +01:00
Get rid of concurrent map writes, once and for all
This commit is contained in:
parent
b29502e3cc
commit
27dc1f9117
2
go.mod
2
go.mod
@ -53,7 +53,7 @@ require (
|
||||
golang.org/x/crypto v0.1.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sync v0.1.0
|
||||
golang.org/x/sys v0.7.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
"github.com/garraflavatra/rolens/internal/ui"
|
||||
"github.com/ncruces/zenity"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
"golang.org/x/sync/syncmap"
|
||||
)
|
||||
|
||||
type EnvironmentInfo struct {
|
||||
@ -32,15 +33,13 @@ type EnvironmentInfo struct {
|
||||
|
||||
type App struct {
|
||||
Env EnvironmentInfo
|
||||
State map[string]string
|
||||
State syncmap.Map
|
||||
ctx context.Context
|
||||
ui *ui.UI
|
||||
}
|
||||
|
||||
func NewApp() *App {
|
||||
a := &App{
|
||||
State: make(map[string]string),
|
||||
}
|
||||
a := &App{}
|
||||
|
||||
_, err := exec.LookPath("mongodump")
|
||||
a.Env.HasMongoDump = err == nil
|
||||
@ -119,6 +118,6 @@ func (a *App) PurgeLogDirectory() {
|
||||
}
|
||||
|
||||
func (a *App) ReportSharedStateVariable(key, value string) {
|
||||
a.State[key] = value
|
||||
a.State.Store(key, value)
|
||||
wailsRuntime.LogDebug(a.ctx, fmt.Sprintf("State: %s=\"%s\"", key, value))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user