mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
databroker: implement leases (#2172)
* databroker: implement leases * return error * handle gRPC errors
This commit is contained in:
parent
a54d43b937
commit
94aa0b1a48
16 changed files with 2135 additions and 149 deletions
|
@ -90,6 +90,12 @@ func (mgr *Manager) UpdateConfig(options ...Option) {
|
|||
|
||||
// Run runs the manager. This method blocks until an error occurs or the given context is canceled.
|
||||
func (mgr *Manager) Run(ctx context.Context) error {
|
||||
leaser := databroker.NewLeaser("identity_manager", time.Second*30, mgr)
|
||||
return leaser.Run(ctx)
|
||||
}
|
||||
|
||||
// RunLeased runs the identity manager when a lease is acquired.
|
||||
func (mgr *Manager) RunLeased(ctx context.Context) error {
|
||||
ctx = withLog(ctx)
|
||||
update := make(chan updateRecordsMessage, 1)
|
||||
clear := make(chan struct{}, 1)
|
||||
|
@ -107,6 +113,11 @@ func (mgr *Manager) Run(ctx context.Context) error {
|
|||
return eg.Wait()
|
||||
}
|
||||
|
||||
// GetDataBrokerServiceClient gets the databroker client.
|
||||
func (mgr *Manager) GetDataBrokerServiceClient() databroker.DataBrokerServiceClient {
|
||||
return mgr.cfg.Load().dataBrokerClient
|
||||
}
|
||||
|
||||
func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecordsMessage, clear <-chan struct{}) error {
|
||||
// wait for initial sync
|
||||
select {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue