mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
Fix many instances of contexts and loggers not being propagated (#5340)
This also replaces instances where we manually write "return ctx.Err()" with "return context.Cause(ctx)" which is functionally identical, but will also correctly propagate cause errors if present.
This commit is contained in:
parent
e1880ba20f
commit
fe31799eb5
77 changed files with 297 additions and 221 deletions
|
@ -124,13 +124,13 @@ func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecords
|
|||
// wait for initial sync
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
return context.Cause(ctx)
|
||||
case <-clear:
|
||||
mgr.reset()
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
return context.Cause(ctx)
|
||||
case msg := <-update:
|
||||
mgr.onUpdateRecords(ctx, msg)
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecords
|
|||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
return context.Cause(ctx)
|
||||
case <-clear:
|
||||
mgr.reset()
|
||||
case msg := <-update:
|
||||
|
|
|
@ -17,7 +17,7 @@ type dataBrokerSyncer struct {
|
|||
}
|
||||
|
||||
func newDataBrokerSyncer(
|
||||
_ context.Context,
|
||||
ctx context.Context,
|
||||
cfg *atomicutil.Value[*config],
|
||||
update chan<- updateRecordsMessage,
|
||||
clear chan<- struct{},
|
||||
|
@ -28,7 +28,7 @@ func newDataBrokerSyncer(
|
|||
update: update,
|
||||
clear: clear,
|
||||
}
|
||||
syncer.syncer = databroker.NewSyncer("identity_manager", syncer)
|
||||
syncer.syncer = databroker.NewSyncer(ctx, "identity_manager", syncer)
|
||||
return syncer
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ type sessionSyncerHandler struct {
|
|||
}
|
||||
|
||||
func newSessionSyncer(ctx context.Context, mgr *Manager) *databroker.Syncer {
|
||||
return databroker.NewSyncer("identity_manager/sessions", sessionSyncerHandler{baseCtx: ctx, mgr: mgr},
|
||||
return databroker.NewSyncer(ctx, "identity_manager/sessions", sessionSyncerHandler{baseCtx: ctx, mgr: mgr},
|
||||
databroker.WithTypeURL(grpcutil.GetTypeURL(new(session.Session))))
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ type userSyncerHandler struct {
|
|||
}
|
||||
|
||||
func newUserSyncer(ctx context.Context, mgr *Manager) *databroker.Syncer {
|
||||
return databroker.NewSyncer("identity_manager/users", userSyncerHandler{baseCtx: ctx, mgr: mgr},
|
||||
return databroker.NewSyncer(ctx, "identity_manager/users", userSyncerHandler{baseCtx: ctx, mgr: mgr},
|
||||
databroker.WithTypeURL(grpcutil.GetTypeURL(new(user.User))))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue