mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
add options to adjust databroker lease ttl, and retry initial interval (#5391)
This commit is contained in:
parent
f876e2f31d
commit
ecd2855dcc
7 changed files with 79 additions and 13 deletions
|
@ -11,6 +11,7 @@ var (
|
|||
defaultSessionRefreshGracePeriod = 1 * time.Minute
|
||||
defaultSessionRefreshCoolOffDuration = 10 * time.Second
|
||||
defaultUpdateUserInfoInterval = 10 * time.Minute
|
||||
defaultLeaseTTL = 30 * time.Second
|
||||
)
|
||||
|
||||
type config struct {
|
||||
|
@ -19,6 +20,7 @@ type config struct {
|
|||
sessionRefreshGracePeriod time.Duration
|
||||
sessionRefreshCoolOffDuration time.Duration
|
||||
updateUserInfoInterval time.Duration
|
||||
leaseTTL time.Duration
|
||||
now func() time.Time
|
||||
eventMgr *events.Manager
|
||||
enabled bool
|
||||
|
@ -31,6 +33,7 @@ func newConfig(options ...Option) *config {
|
|||
WithNow(time.Now)(cfg)
|
||||
WithUpdateUserInfoInterval(defaultUpdateUserInfoInterval)(cfg)
|
||||
WithEnabled(true)(cfg)
|
||||
WithLeaseTTL(defaultLeaseTTL)(cfg)
|
||||
for _, option := range options {
|
||||
option(cfg)
|
||||
}
|
||||
|
@ -95,3 +98,10 @@ func WithUpdateUserInfoInterval(dur time.Duration) Option {
|
|||
cfg.updateUserInfoInterval = dur
|
||||
}
|
||||
}
|
||||
|
||||
// WithLeaseTTL sets the TTL used by the leaser.
|
||||
func WithLeaseTTL(ttl time.Duration) Option {
|
||||
return func(o *config) {
|
||||
o.leaseTTL = ttl
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue