this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

carstore: don't ignore the first record in sqlite (#1103)

Small fix to the SQLite carstore -- the first record in the cache will
have ID 0, there's no reason to ignore it. Naturally, this case happens
a lot in testing and stuff 'cause the first attempt to get a revision on
an empty database will fail

authored by

Whyrusleeping and committed by
GitHub
1e8718ae c74e8a32

+7 -8
+7 -8
carstore/sqlite_store.go
··· 6 6 "database/sql" 7 7 "errors" 8 8 "fmt" 9 - "go.opentelemetry.io/otel/attribute" 10 9 "io" 11 10 "log/slog" 12 11 "os" 13 12 "path/filepath" 13 + 14 + "go.opentelemetry.io/otel/attribute" 14 15 15 16 "github.com/bluesky-social/indigo/models" 16 17 blockformat "github.com/ipfs/go-block-format" ··· 215 216 if lastShard == nil { 216 217 return cid.Undef, nil 217 218 } 218 - if lastShard.ID == 0 { 219 - return cid.Undef, nil 220 - } 221 219 222 220 return lastShard.Root.CID, nil 223 221 } ··· 229 227 return "", err 230 228 } 231 229 if lastShard == nil { 232 - return "", nil 233 - } 234 - if lastShard.ID == 0 { 235 230 return "", nil 236 231 } 237 232 ··· 476 471 if err != nil { 477 472 return nil, fmt.Errorf("getb bad scan, %w", err) 478 473 } 479 - return blocks.NewBlock(blockb), nil 474 + blk, err := blocks.NewBlockWithCid(blockb, bcid) 475 + if err != nil { 476 + return nil, fmt.Errorf("getb bad block, %w", err) 477 + } 478 + return blk, nil 480 479 } 481 480 return nil, ErrNothingThere 482 481 }