MCPcopy Index your code
hub / github.com/koding/kite / RunCleaner

Method RunCleaner

kontrol/postgres.go:93–106  ·  view source on GitHub ↗

RunCleaner deletes every "interval" duration rows which are older than "expire" duration based on the "updated_at" field. For more info check CleanExpireRows which is used to delete old rows.

(interval, expire time.Duration)

Source from the content-addressed store, hash-verified

91// "expire" duration based on the "updated_at" field. For more info check
92// CleanExpireRows which is used to delete old rows.
93func (p *Postgres) RunCleaner(interval, expire time.Duration) {
94 cleanFunc := func() {
95 affectedRows, err := p.CleanExpiredRows(expire)
96 if err != nil {
97 p.Log.Warning("postgres: cleaning old rows failed: %s", err)
98 } else if affectedRows != 0 {
99 p.Log.Debug("postgres: cleaned up %d rows", affectedRows)
100 }
101 }
102
103 for range time.Tick(interval) {
104 cleanFunc()
105 }
106}
107
108// CleanExpiredRows deletes rows that are at least "expire" duration old. So if
109// say an expire duration of 10 second is given, it will delete all rows that

Callers 1

NewPostgresFunction · 0.95

Calls 3

CleanExpiredRowsMethod · 0.95
WarningMethod · 0.80
DebugMethod · 0.80

Tested by

no test coverage detected