Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 68b7a1e

Browse files
authored
Merge pull request #17 from oleg-balunenko/fix-bar
fix(service): Fix bar counter
2 parents c1fc255 + 89a83a0 commit 68b7a1e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

internal/service/service.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -360,28 +360,29 @@ func (svc *Service) processNotMutual(pBar bar.Bar, notMutual []models.User) (int
360360
whitelist := svc.instagram.Whitelist()
361361

362362
LOOP:
363-
for i, nu := range notMutual {
363+
for _, nu := range notMutual {
364364
if errsNum >= errsLimit {
365365
return count, ErrCorrupted
366366
}
367367

368-
if i != 0 {
369-
pBar.Progress() <- struct{}{}
370-
}
371-
372368
select {
373369
case <-svc.ctx.Done():
374370
break LOOP
375371
case <-ticker.C:
376-
if _, ok := whitelist[nu.UserName]; !ok {
377-
if err := svc.UnFollow(nu); err != nil {
378-
log.Errorf("failed to unfollow [%s]: %v", nu.UserName, err)
379-
errsNum++
380-
continue
381-
}
382-
count++
372+
if _, exist := whitelist[nu.UserName]; exist {
373+
continue
383374
}
384375

376+
pBar.Progress() <- struct{}{}
377+
378+
if err := svc.UnFollow(nu); err != nil {
379+
log.Errorf("failed to unfollow [%s]: %v", nu.UserName, err)
380+
errsNum++
381+
continue
382+
}
383+
384+
count++
385+
385386
if count >= svc.instagram.limits.unFollow {
386387
return count, ErrLimitExceed
387388
}

0 commit comments

Comments
 (0)