MCPcopy
hub / github.com/sourcegraph/checkup / Maintain

Method Maintain

storage/sql/sql.go:177–192  ·  view source on GitHub ↗

Maintain deletes check files that are older than sql.CheckExpiry.

()

Source from the content-addressed store, hash-verified

175
176// Maintain deletes check files that are older than sql.CheckExpiry.
177func (sql Storage) Maintain() error {
178 if sql.CheckExpiry == 0 {
179 return nil
180 }
181
182 db, err := sql.dbConnect()
183 if err != nil {
184 return err
185 }
186 defer db.Close()
187
188 const st = `DELETE FROM "checks" WHERE timestamp < ?`
189 ts := time.Now().Add(-1 * sql.CheckExpiry).UnixNano()
190 _, err = db.Exec(st, ts)
191 return err
192}
193
194// initialize creates the "checks" table in the database.
195func (sql Storage) initialize() error {

Callers 1

TestSQLFunction · 0.95

Implementers 5

fakecheckup_test.go
Storagestorage/sql/sql.go
Storagestorage/s3/s3.go
Storagestorage/github/github.go
Storagestorage/fs/fs.go

Calls 1

dbConnectMethod · 0.95

Tested by 1

TestSQLFunction · 0.76