| 191 | } |
| 192 | |
| 193 | func (c *Chain) queueSnapshot(ctx context.Context, height uint64, timestamp time.Time, s *state.Snapshot) { |
| 194 | // Non-blockingly queue the snapshot for storage. |
| 195 | ps := pendingSnapshot{height: height, snapshot: s} |
| 196 | select { |
| 197 | case c.pendingSnapshots <- ps: |
| 198 | c.lastQueuedSnapshot = timestamp |
| 199 | default: |
| 200 | // Skip it; saving snapshots is taking longer than the snapshotting period. |
| 201 | log.Printf(ctx, "snapshot storage is taking too long; last queued at %s", |
| 202 | c.lastQueuedSnapshot) |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | func (c *Chain) setHeight(h uint64) { |
| 207 | // We call setHeight from two places independently: |