Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keystore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
id
keystore
Commits
073a2083
Commit
073a2083
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Update go-common dependency
parent
973a591b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vendor/git.autistici.org/ai3/go-common/ldap/pool.go
+27
-9
27 additions, 9 deletions
vendor/git.autistici.org/ai3/go-common/ldap/pool.go
vendor/vendor.json
+15
-15
15 additions, 15 deletions
vendor/vendor.json
with
42 additions
and
24 deletions
vendor/git.autistici.org/ai3/go-common/ldap/pool.go
+
27
−
9
View file @
073a2083
...
...
@@ -7,11 +7,30 @@ import (
"net/url"
"time"
"git.autistici.org/ai3/go-common/clientutil"
"github.com/cenkalti/backoff"
"gopkg.in/ldap.v2"
)
// Parameters that define the exponential backoff algorithm used.
var
(
ExponentialBackOffInitialInterval
=
100
*
time
.
Millisecond
ExponentialBackOffMultiplier
=
1.4142
)
// newExponentialBackOff creates a backoff.ExponentialBackOff object
// with our own default values.
func
newExponentialBackOff
()
*
backoff
.
ExponentialBackOff
{
b
:=
backoff
.
NewExponentialBackOff
()
b
.
InitialInterval
=
ExponentialBackOffInitialInterval
b
.
Multiplier
=
ExponentialBackOffMultiplier
// Set MaxElapsedTime to 0 because we expect the overall
// timeout to be dictated by the request Context.
b
.
MaxElapsedTime
=
0
return
b
}
// ConnectionPool provides a goroutine-safe pool of long-lived LDAP
// connections that will reconnect on errors.
type
ConnectionPool
struct
{
...
...
@@ -129,14 +148,14 @@ func NewConnectionPool(uri, bindDN, bindPw string, cacheSize int) (*ConnectionPo
}
func
(
p
*
ConnectionPool
)
doRequest
(
ctx
context
.
Context
,
fn
func
(
*
ldap
.
Conn
)
error
)
error
{
return
clientutil
.
Retry
(
func
()
error
{
return
backoff
.
Retry
(
func
()
error
{
conn
,
err
:=
p
.
Get
(
ctx
)
if
err
!=
nil
{
// Here conn is nil, so we don't need to Release it.
if
isTemporaryLDAPError
(
err
)
{
return
clientutil
.
TempError
(
err
)
return
err
}
return
err
return
backoff
.
Permanent
(
err
)
}
if
deadline
,
ok
:=
ctx
.
Deadline
();
ok
{
...
...
@@ -144,13 +163,12 @@ func (p *ConnectionPool) doRequest(ctx context.Context, fn func(*ldap.Conn) erro
}
err
=
fn
(
conn
)
if
err
!=
nil
&&
isTemporaryLDAPError
(
err
)
{
p
.
Release
(
conn
,
err
)
return
clientutil
.
TempError
(
err
)
}
p
.
Release
(
conn
,
err
)
if
err
!=
nil
&&
!
isTemporaryLDAPError
(
err
)
{
err
=
backoff
.
Permanent
(
err
)
}
return
err
},
backoff
.
WithContext
(
clientutil
.
N
ewExponentialBackOff
(),
ctx
))
},
backoff
.
WithContext
(
n
ewExponentialBackOff
(),
ctx
))
}
// Search performs the given search request. It will retry the request
...
...
This diff is collapsed.
Click to expand it.
vendor/vendor.json
+
15
−
15
View file @
073a2083
...
...
@@ -5,44 +5,44 @@
{
"checksumSHA1"
:
"raJx5BjBbVQG0ylGSjPpi+JvqjU="
,
"path"
:
"git.autistici.org/ai3/go-common"
,
"revision"
:
"
193e29e61c81e6bb5548bfe89bba05836d06b61f
"
,
"revisionTime"
:
"2018-08-1
6T21:47:58
Z"
"revision"
:
"
39b1908a9e399db1a0ceebb0fe4f3d3c35298357
"
,
"revisionTime"
:
"2018-08-1
7T06:38:25
Z"
},
{
"checksumSHA1"
:
"49MChcx9D+/+pCyl/F469TcQcK4="
,
"path"
:
"git.autistici.org/ai3/go-common/clientutil"
,
"revision"
:
"
193e29e61c81e6bb5548bfe89bba05836d06b61f
"
,
"revisionTime"
:
"2018-08-1
6T21:47:58
Z"
"revision"
:
"
39b1908a9e399db1a0ceebb0fe4f3d3c35298357
"
,
"revisionTime"
:
"2018-08-1
7T06:38:25
Z"
},
{
"checksumSHA1"
:
"
udgeRdy83f6tJmhoKXFxCfwOIZw
="
,
"checksumSHA1"
:
"
kQbBWZqrXc95wodlrOKEshQVaBo
="
,
"path"
:
"git.autistici.org/ai3/go-common/ldap"
,
"revision"
:
"
193e29e61c81e6bb5548bfe89bba05836d06b61f
"
,
"revisionTime"
:
"2018-08-1
6T21:47:58
Z"
"revision"
:
"
39b1908a9e399db1a0ceebb0fe4f3d3c35298357
"
,
"revisionTime"
:
"2018-08-1
7T06:38:25
Z"
},
{
"checksumSHA1"
:
"7VBLbwaK1m/jwsk8sLsh4iD9T/s="
,
"path"
:
"git.autistici.org/ai3/go-common/serverutil"
,
"revision"
:
"
193e29e61c81e6bb5548bfe89bba05836d06b61f
"
,
"revisionTime"
:
"2018-08-1
6T21:47:58
Z"
"revision"
:
"
39b1908a9e399db1a0ceebb0fe4f3d3c35298357
"
,
"revisionTime"
:
"2018-08-1
7T06:38:25
Z"
},
{
"checksumSHA1"
:
"T2vf4xzKRqoIjfXlofMgudKA8rA="
,
"path"
:
"git.autistici.org/ai3/go-common/unix"
,
"revision"
:
"
193e29e61c81e6bb5548bfe89bba05836d06b61f
"
,
"revisionTime"
:
"2018-08-1
6T21:47:58
Z"
"revision"
:
"
39b1908a9e399db1a0ceebb0fe4f3d3c35298357
"
,
"revisionTime"
:
"2018-08-1
7T06:38:25
Z"
},
{
"checksumSHA1"
:
"OY/kamdVCtqr00dhc+STq7ApbmA="
,
"path"
:
"git.autistici.org/ai3/go-common/userenckey"
,
"revision"
:
"
193e29e61c81e6bb5548bfe89bba05836d06b61f
"
,
"revisionTime"
:
"2018-08-1
6T21:47:58
Z"
"revision"
:
"
39b1908a9e399db1a0ceebb0fe4f3d3c35298357
"
,
"revisionTime"
:
"2018-08-1
7T06:38:25
Z"
},
{
"checksumSHA1"
:
"QHzKyLU57jphYBzuhl4ELbCwVX0="
,
"path"
:
"git.autistici.org/id/go-sso"
,
"revision"
:
"
dc62a1d65832c
8a
3
f73
e7a0cffb78ad0b4d3d8fc
"
,
"revisionTime"
:
"2018-0
2
-1
8T15:46:43
Z"
"revision"
:
"
a7ddc7fb9c9053ad8c239e6e96
8a
6
f73
bb181021
"
,
"revisionTime"
:
"2018-0
8
-1
7T07:29:35
Z"
},
{
"checksumSHA1"
:
"spyv5/YFBjYyZLZa1U2LBfDR8PM="
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment