Skip to content

Commit

Permalink
Add a TODO to refactor how we fetch tiles during integrate
Browse files Browse the repository at this point in the history
  • Loading branch information
roger2hk committed Jul 25, 2024
1 parent fd4b739 commit a36a173
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storage/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,13 @@ func (s *Storage) sequenceBatch(ctx context.Context, entries []*tessera.Entry) e
func (s *Storage) integrate(ctx context.Context, tx *sql.Tx, fromSeq uint64, entries []*tessera.Entry) error {
tb := storage.NewTreeBuilder(func(ctx context.Context, tileIDs []storage.TileID, treeSize uint64) ([]*api.HashTile, error) {
r := make([]*api.HashTile, len(tileIDs))

// TODO(#21): Refactor the following to fully utilise the MySQL for fetching multiple tiles in one query with the same ordering.
errG := errgroup.Group{}
for i, id := range tileIDs {
i := i
id := id
errG.Go(func() error {
// TODO: Refactor the query into a function.
row := tx.QueryRowContext(ctx, selectSubtreeByLevelAndIndexSQL, id.Level, id.Index)
if err := row.Err(); err != nil {
return err
Expand Down

0 comments on commit a36a173

Please sign in to comment.