fix: fix parallel access of env vars
This commit is contained in:
parent
e0d8644264
commit
78a673e4ad
|
@ -26,20 +26,11 @@ func (e *EnvStore) UpdateStore(store map[string]interface{}) {
|
|||
|
||||
// GetStore returns the env store
|
||||
func (e *EnvStore) GetStore() map[string]interface{} {
|
||||
if os.Getenv("ENV") != "test" {
|
||||
e.mutex.Lock()
|
||||
defer e.mutex.Unlock()
|
||||
}
|
||||
|
||||
return e.store
|
||||
}
|
||||
|
||||
// Get returns the value of the key in evn store
|
||||
func (e *EnvStore) Get(key string) interface{} {
|
||||
if os.Getenv("ENV") != "test" {
|
||||
e.mutex.Lock()
|
||||
defer e.mutex.Unlock()
|
||||
}
|
||||
return e.store[key]
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,6 @@ func (c *provider) ClearStore() error {
|
|||
|
||||
// GetUserSessions returns all the user session token from the in-memory store.
|
||||
func (c *provider) GetUserSessions(userId string) map[string]string {
|
||||
if os.Getenv("ENV") != "test" {
|
||||
c.mutex.Lock()
|
||||
defer c.mutex.Unlock()
|
||||
}
|
||||
res := map[string]string{}
|
||||
for k, v := range c.stateStore {
|
||||
split := strings.Split(v, "@")
|
||||
|
@ -61,11 +57,6 @@ func (c *provider) SetState(key, state string) error {
|
|||
|
||||
// GetState gets the state from the in-memory store.
|
||||
func (c *provider) GetState(key string) (string, error) {
|
||||
if os.Getenv("ENV") != "test" {
|
||||
c.mutex.Lock()
|
||||
defer c.mutex.Unlock()
|
||||
}
|
||||
|
||||
state := ""
|
||||
if stateVal, ok := c.stateStore[key]; ok {
|
||||
state = stateVal
|
||||
|
|
Loading…
Reference in New Issue
Block a user