mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-30 23:09:23 +02:00
cr
This commit is contained in:
parent
9399139757
commit
fd24e0e7be
7 changed files with 93 additions and 49 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -44,7 +45,7 @@ func Run(ctx context.Context, opts ...Option) error {
|
|||
eg.Go(func() error { return run(ctx, "pomerium-core", c.runPomeriumCore, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "zero-reconciler", c.runReconciler, src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "connect-log", c.RunConnectLog, nil) })
|
||||
eg.Go(func() error { return run(ctx, "zero-analytics", c.runAnalytics(), src.WaitReady) })
|
||||
eg.Go(func() error { return run(ctx, "zero-analytics", c.runAnalytics, src.WaitReady) })
|
||||
return eg.Wait()
|
||||
}
|
||||
|
||||
|
@ -120,22 +121,12 @@ func (c *controller) runReconciler(ctx context.Context) error {
|
|||
)
|
||||
}
|
||||
|
||||
func (c *controller) runAnalytics() func(ctx context.Context) error {
|
||||
disable := false
|
||||
return func(ctx context.Context) error {
|
||||
if disable {
|
||||
log.Ctx(ctx).Info().Msg("analytics disabled due to previous error")
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}
|
||||
|
||||
err := analytics.Collect(ctx, c.GetDataBrokerServiceClient())
|
||||
if err != nil && ctx.Err() == nil {
|
||||
disable = true
|
||||
log.Ctx(ctx).Error().Err(err).Msg("error collecting analytics, disabling")
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
func (c *controller) runAnalytics(ctx context.Context) error {
|
||||
err := analytics.Collect(ctx, c.GetDataBrokerServiceClient(), time.Second*30)
|
||||
if err != nil && ctx.Err() == nil {
|
||||
log.Ctx(ctx).Error().Err(err).Msg("error collecting analytics, disabling")
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue