projects
/
kraftakt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
059b0ae
)
Package app: Add mutex to persistingTokenSource.
author
Florian Forster
<ff@octo.it>
Mon, 22 Jan 2018 07:34:51 +0000
(08:34 +0100)
committer
Florian Forster
<ff@octo.it>
Mon, 22 Jan 2018 07:34:51 +0000
(08:34 +0100)
app/user.go
patch
|
blob
|
history
diff --git
a/app/user.go
b/app/user.go
index
e47a5cc
..
1215653
100644
(file)
--- a/
app/user.go
+++ b/
app/user.go
@@
-4,6
+4,7
@@
import (
"context"
"fmt"
"net/http"
+ "sync"
"github.com/google/uuid"
legacy_context "golang.org/x/net/context"
@@
-107,9
+108,14
@@
type persistingTokenSource struct {
t *oauth2.Token
src oauth2.TokenSource
key *datastore.Key
+
+ sync.Mutex
}
func (s *persistingTokenSource) Token() (*oauth2.Token, error) {
+ s.Lock()
+ defer s.Unlock()
+
tok, err := s.src.Token()
if err != nil {
return nil, err