Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
d9899658
Commit
d9899658
authored
Dec 04, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d47b0f9c
Pipeline
#136
failed with stage
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
28 deletions
+4
-28
blob.go
blob.go
+4
-28
No files found.
blob.go
View file @
d9899658
...
...
@@ -60,6 +60,9 @@ type AuthCache struct {
var
authCache
=
AuthCache
{
cached
:
make
(
map
[
string
]
*
AuthCacheEntry
)}
// Verify that download access is ok or not.
// first we try to use the cache; if information is not there -> ask auth backend
// download is ok if AuthReply.RepoPath != ""
// XXX u should not be in args?
func
(
c
*
AuthCache
)
VerifyDownloadAccess
(
u
*
upstream
,
project
string
)
AuthReply
{
var
authReply
AuthReply
...
...
@@ -119,7 +122,7 @@ have_entry:
// Time period for refreshing / removing unused entires in authCache
const
authCacheRefresh
=
5
*
time
.
Second
// XXX 30
const
authCacheRefresh
=
30
*
time
.
Second
// Goroutine to refresh auth cache entry periodically while it is used.
// if the entry is detected to be not used - remove it from cache and stop refreshing.
...
...
@@ -191,33 +194,6 @@ func askAuthBackend(u *upstream, project string) AuthReply {
return
authReply
}
/*
// Verify that download access is ok or not.
// first we try to see authCache; if information is not there -> ask auth backend
// download is ok if AuthReply.RepoPath != ""
// XXX return -> *AuthReply ?
func verifyDownloadAccess(u *upstream, project string) AuthReply {
// XXX lock authCache
auth, ok := authCache[project]
if ok {
auth.Nhit++
//log.Printf("authReply for %v cached ago: %v (hits: %v)",
// project,
// time.Since(time.Unix(auth.Tauth, 0)),
// auth.Nhit)
return auth.AuthReply
}
authReply := askAuthBackend(u, project)
// XXX lock
// store in cache and start cache entry refresher
authCache[project] = &AuthCacheEntry{authReply, time.Now().Unix(), 0}
go authRefreshEntry(u, project)
return authReply
}
*/
func
verifyDownloadAccess
(
u
*
upstream
,
project
string
)
AuthReply
{
return
authCache
.
VerifyDownloadAccess
(
u
,
project
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment