File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
"net/http"
24
24
"strconv"
25
25
"strings"
26
+ "sync"
26
27
27
28
"github.com/gin-gonic/gin"
28
29
"github.com/mysteriumnetwork/go-rest/apierror"
@@ -43,6 +44,7 @@ type ServiceEndpoint struct {
43
44
optionsParser map [string ]services.ServiceOptionsParser
44
45
proposalRepository proposalRepository
45
46
tequilaApiClient * tequilapi_client.Client
47
+ activeServicesMu sync.Mutex
46
48
}
47
49
48
50
var (
@@ -249,6 +251,10 @@ func (se *ServiceEndpoint) ServiceStop(c *gin.Context) {
249
251
}
250
252
251
253
func (se * ServiceEndpoint ) updateActiveServicesInUserConfig () {
254
+ // restrict concurrent update of ActiveServices property, so that statuses of all services are written the last
255
+ se .activeServicesMu .Lock ()
256
+ defer se .activeServicesMu .Unlock ()
257
+
252
258
runningInstances := se .serviceManager .List (false )
253
259
activeServices := make ([]string , len (runningInstances ))
254
260
for i , service := range runningInstances {
You can’t perform that action at this time.
0 commit comments