(ctx context.Context, authType string, duration *time.Duration)
| 185 | } |
| 186 | |
| 187 | func (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 | |
| 207 | func (c *Client) flushAgents(ctx context.Context, authType string, duration *time.Duration) { |
| 208 | if duration == nil { |
no test coverage detected