Skip to content

Commit

Permalink
Properly lock access to the shared map
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Aug 4, 2020
1 parent 5dcc17c commit d4d4d35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ description: >
# _struct: config_

{{% dir name="iopsecret" type="string" default="" %}}
The iopsecret used to connect to the wopiserver. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L60)
The iopsecret used to connect to the wopiserver. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L61)
{{< highlight toml >}}
[grpc.services.appprovider]
iopsecret = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="wopiurl" type="string" default="" %}}
The wopiserver's URL. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L61)
The wopiserver's URL. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L62)
{{< highlight toml >}}
[grpc.services.appprovider]
wopiurl = ""
Expand Down
5 changes: 3 additions & 2 deletions internal/grpc/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"path"
"strconv"
"strings"
"sync"
"time"

providerpb "github.com/cs3org/go-cs3apis/cs3/app/provider/v1beta1"
Expand All @@ -51,7 +52,7 @@ func init() {
type service struct {
provider app.Provider
conf *config
appsURLMap map[string]interface{}
appsURLMap sync.Map
}

type config struct {
Expand Down Expand Up @@ -142,7 +143,7 @@ func (s *service) getWopiAppEndpoints(ctx context.Context) error {
return err
}

s.appsURLMap = make(map[string]interface{})
s.appsURLMap = sync.Map{}
err = json.Unmarshal(appsBody, &s.appsURLMap)
if err != nil {
return err
Expand Down

0 comments on commit d4d4d35

Please sign in to comment.