Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Sep 21, 2023
1 parent 6c77432 commit 31f985e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion bgs/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,14 @@ func (bgs *BGS) handleAdminCompactRepo(e echo.Context) error {
return fmt.Errorf("no such user: %w", err)
}

if err := bgs.repoman.CarStore().CompactUserShards(ctx, u.ID); err != nil {
stats, err := bgs.repoman.CarStore().CompactUserShards(ctx, u.ID)
if err != nil {
return fmt.Errorf("compaction failed: %w", err)
}

return e.JSON(200, map[string]any{
"success": "true",
"stats": stats,
})
}

Expand Down
2 changes: 1 addition & 1 deletion bgs/bgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ func (bgs *BGS) runRepoCompaction(ctx context.Context) error {
}

for _, r := range repos {
if err := bgs.repoman.CarStore().CompactUserShards(ctx, r.Usr); err != nil {
if _, err := bgs.repoman.CarStore().CompactUserShards(ctx, r.Usr); err != nil {
log.Errorf("failed to compact shards for user %d: %s", r.Usr, err)
continue
}
Expand Down
10 changes: 5 additions & 5 deletions carstore/bs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,11 @@ func (cs *CarStore) GetCompactionTargets(ctx context.Context) ([]CompactionTarge
}

type CompactionStats struct {
StartShards int
NewShards int
SkippedShards int
ShardsDeleted int
RefsDeleted int
StartShards int `json:"startShards"`
NewShards int `json:"newShards"`
SkippedShards int `json:"skippedShards"`
ShardsDeleted int `json:"shardsDeleted"`
RefsDeleted int `json:"refsDeleted"`
}

func (cs *CarStore) CompactUserShards(ctx context.Context, user models.Uid) (*CompactionStats, error) {
Expand Down

0 comments on commit 31f985e

Please sign in to comment.