MCPcopy
hub / github.com/crowdsecurity/crowdsec / flushBouncers

Method flushBouncers

pkg/database/flush.go:187–205  ·  view source on GitHub ↗
(ctx context.Context, authType string, duration *time.Duration)

Source from the content-addressed store, hash-verified

185}
186
187func (c *Client) flushBouncers(ctx context.Context, authType string, duration *time.Duration) {
188 if duration == nil {
189 return
190 }
191
192 count, err := c.Ent.Bouncer.Delete().Where(
193 bouncer.LastPullLTE(time.Now().UTC().Add(-*duration)),
194 ).Where(
195 bouncer.AuthTypeEQ(authType),
196 ).Exec(ctx)
197 if err != nil {
198 c.Log.Errorf("while auto-deleting expired bouncers (%s): %s", authType, err)
199 return
200 }
201
202 if count > 0 {
203 c.Log.Infof("deleted %d expired bouncers (%s)", count, authType)
204 }
205}
206
207func (c *Client) flushAgents(ctx context.Context, authType string, duration *time.Duration) {
208 if duration == nil {

Callers 1

Calls 6

LastPullLTEFunction · 0.92
AuthTypeEQFunction · 0.92
ExecMethod · 0.45
WhereMethod · 0.45
DeleteMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected