MCPcopy Create free account
hub / github.com/PostHog/duckgres / run

Method run

server/checkpoint.go:135–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133}
134
135func (c *DuckLakeCheckpointer) run() {
136 slog.Info("DuckLake checkpoint starting.")
137 start := time.Now()
138 _, err := c.db.Exec("CHECKPOINT ducklake")
139 finished := time.Now()
140 duration := finished.Sub(start)
141
142 status := "success"
143 var errMsg *string
144 if err != nil {
145 status = "failed"
146 s := err.Error()
147 errMsg = &s
148 slog.Warn("DuckLake checkpoint failed.", "error", err)
149 } else {
150 slog.Info("DuckLake checkpoint complete.", "duration", duration.Round(time.Millisecond))
151 }
152
153 if _, logErr := c.db.Exec(
154 "INSERT INTO ducklake.system.checkpoints (started_at, finished_at, duration_ms, status, error) VALUES ($1, $2, $3, $4, $5)",
155 start, finished, duration.Milliseconds(), status, errMsg,
156 ); logErr != nil {
157 slog.Warn("Failed to log checkpoint to system.checkpoints.", "error", logErr)
158 }
159}

Callers 3

loopMethod · 0.95

Calls 3

NowMethod · 0.80
ExecMethod · 0.65
ErrorMethod · 0.45