fix: go fixing
This commit is contained in:
@@ -124,7 +124,6 @@ func (c *Client) GetFullRelations(ctx context.Context, id int) ([]RelationEntry,
|
|||||||
results := make(chan fetchResult, len(allowedEntries))
|
results := make(chan fetchResult, len(allowedEntries))
|
||||||
|
|
||||||
for i, entry := range allowedEntries {
|
for i, entry := range allowedEntries {
|
||||||
i, entry := i, entry
|
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
anime, err := c.GetAnimeByID(gCtx, entry.ID)
|
anime, err := c.GetAnimeByID(gCtx, entry.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -174,10 +174,7 @@ func formatNumber(n int) string {
|
|||||||
s := fmt.Sprintf("%d", n)
|
s := fmt.Sprintf("%d", n)
|
||||||
var res []string
|
var res []string
|
||||||
for i := len(s); i > 0; i -= 3 {
|
for i := len(s); i > 0; i -= 3 {
|
||||||
start := i - 3
|
start := max(i-3, 0)
|
||||||
if start < 0 {
|
|
||||||
start = 0
|
|
||||||
}
|
|
||||||
res = append([]string{s[start:i]}, res...)
|
res = append([]string{s[start:i]}, res...)
|
||||||
}
|
}
|
||||||
return strings.Join(res, " ")
|
return strings.Join(res, " ")
|
||||||
|
|||||||
@@ -155,14 +155,12 @@ func (w *Worker) syncRelations(ctx context.Context) {
|
|||||||
jobs := make(chan database.GetAnimeNeedingRelationSyncRow, len(animes))
|
jobs := make(chan database.GetAnimeNeedingRelationSyncRow, len(animes))
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
for i := 0; i < workerCount; i++ {
|
for range workerCount {
|
||||||
wg.Add(1)
|
wg.Go(func() {
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
for a := range jobs {
|
for a := range jobs {
|
||||||
w.syncSingleAnime(ctx, a.ID)
|
w.syncSingleAnime(ctx, a.ID)
|
||||||
}
|
}
|
||||||
}()
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, a := range animes {
|
for _, a := range animes {
|
||||||
|
|||||||
Reference in New Issue
Block a user