Skip to content

Commit 78a673e

Browse files
committed
fix: fix parallel access of env vars
1 parent e0d8644 commit 78a673e

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

server/memorystore/providers/inmemory/envstore.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,11 @@ func (e *EnvStore) UpdateStore(store map[string]interface{}) {
2626

2727
// GetStore returns the env store
2828
func (e *EnvStore) GetStore() map[string]interface{} {
29-
if os.Getenv("ENV") != "test" {
30-
e.mutex.Lock()
31-
defer e.mutex.Unlock()
32-
}
33-
3429
return e.store
3530
}
3631

3732
// Get returns the value of the key in evn store
3833
func (e *EnvStore) Get(key string) interface{} {
39-
if os.Getenv("ENV") != "test" {
40-
e.mutex.Lock()
41-
defer e.mutex.Unlock()
42-
}
4334
return e.store[key]
4435
}
4536

server/memorystore/providers/inmemory/store.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ func (c *provider) ClearStore() error {
1919

2020
// GetUserSessions returns all the user session token from the in-memory store.
2121
func (c *provider) GetUserSessions(userId string) map[string]string {
22-
if os.Getenv("ENV") != "test" {
23-
c.mutex.Lock()
24-
defer c.mutex.Unlock()
25-
}
2622
res := map[string]string{}
2723
for k, v := range c.stateStore {
2824
split := strings.Split(v, "@")
@@ -61,11 +57,6 @@ func (c *provider) SetState(key, state string) error {
6157

6258
// GetState gets the state from the in-memory store.
6359
func (c *provider) GetState(key string) (string, error) {
64-
if os.Getenv("ENV") != "test" {
65-
c.mutex.Lock()
66-
defer c.mutex.Unlock()
67-
}
68-
6960
state := ""
7061
if stateVal, ok := c.stateStore[key]; ok {
7162
state = stateVal

0 commit comments

Comments
 (0)