this repo has no description
0
fork

Configure Feed

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

Merge branch 'main' of github.com:bluesky-social/indigo

+25 -5
+3
bgs/bgs.go
··· 616 616 } 617 617 618 618 func (bgs *BGS) lookupUserByDid(ctx context.Context, did string) (*User, error) { 619 + ctx, span := otel.Tracer("bgs").Start(ctx, "lookupUserByDid") 620 + defer span.End() 621 + 619 622 var u User 620 623 if err := bgs.db.Find(&u, "did = ?", did).Error; err != nil { 621 624 return nil, err
+21 -4
carstore/bs.go
··· 265 265 } 266 266 267 267 func (cs *CarStore) getLastShard(ctx context.Context, user models.Uid) (*CarShard, error) { 268 + ctx, span := otel.Tracer("carstore").Start(ctx, "getLastShard") 269 + defer span.End() 270 + 268 271 maybeLs := cs.checkLastShardCache(user) 269 272 if maybeLs != nil { 270 273 return maybeLs, nil ··· 637 640 Usr: ds.user, 638 641 } 639 642 643 + if err := ds.putShard(ctx, &shard, brefs); err != nil { 644 + return nil, err 645 + } 646 + 647 + return buf.Bytes(), nil 648 + } 649 + 650 + func (ds *DeltaSession) putShard(ctx context.Context, shard *CarShard, brefs []map[string]any) error { 651 + ctx, span := otel.Tracer("carstore").Start(ctx, "putShard") 652 + defer span.End() 653 + 640 654 // TODO: there should be a way to create the shard and block_refs that 641 655 // reference it in the same query, would save a lot of time 642 656 if err := ds.cs.meta.WithContext(ctx).Transaction(func(tx *gorm.DB) error { 643 - if err := tx.WithContext(ctx).Create(&shard).Error; err != nil { 657 + if err := tx.WithContext(ctx).Create(shard).Error; err != nil { 644 658 return fmt.Errorf("failed to create shard in DB tx: %w", err) 645 659 } 646 - ds.cs.putLastShardCache(ds.user, &shard) 660 + ds.cs.putLastShardCache(ds.user, shard) 647 661 648 662 for _, ref := range brefs { 649 663 ref["shard"] = shard.ID ··· 655 669 656 670 return nil 657 671 }); err != nil { 658 - return nil, fmt.Errorf("failed to commit shard DB transaction: %w", err) 672 + return fmt.Errorf("failed to commit shard DB transaction: %w", err) 659 673 } 660 674 661 - return buf.Bytes(), nil 675 + return nil 662 676 } 663 677 664 678 func createBlockRefs(ctx context.Context, tx *gorm.DB, brefs []map[string]any) error { ··· 829 843 } 830 844 831 845 func (cs *CarStore) checkFork(ctx context.Context, user models.Uid, prev cid.Cid) (bool, error) { 846 + ctx, span := otel.Tracer("carstore").Start(ctx, "checkFork") 847 + defer span.End() 848 + 832 849 lastShard, err := cs.getLastShard(ctx, user) 833 850 if err != nil { 834 851 return false, err
+1 -1
repomgr/repomgr.go
··· 994 994 } 995 995 996 996 func (rm *RepoManager) processNewRepo(ctx context.Context, user models.Uid, r io.Reader, until cid.Cid, cb func(ctx context.Context, old, nu cid.Cid, finish func(context.Context) ([]byte, error), bs blockstore.Blockstore) error) error { 997 - ctx, span := otel.Tracer("repoman").Start(ctx, "ImportNewRepo") 997 + ctx, span := otel.Tracer("repoman").Start(ctx, "processNewRepo") 998 998 defer span.End() 999 999 1000 1000 carr, err := car.NewCarReader(r)