Skip to content

Commit

Permalink
fix: Fixing synchronisation key computation
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed May 24, 2022
1 parent 66d47de commit 267fbaa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pkg/notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ func (a App) getKetchupToNotify(ctx context.Context, releases []model.Release) (
}

func releaseKey(r model.Release) string {
return fmt.Sprintf("%d|%s", r.Repository.ID, r.Pattern)
return fmt.Sprintf("%10d|%s", r.Repository.ID, r.Pattern)
}

func ketchupKey(k model.Ketchup) string {
return fmt.Sprintf("%d|%s", k.Repository.ID, k.Pattern)
return fmt.Sprintf("%10d|%s", k.Repository.ID, k.Pattern)
}

func (a App) syncReleasesByUser(ctx context.Context, releases []model.Release, ketchups []model.Ketchup) map[model.User][]model.Release {
Expand Down
25 changes: 16 additions & 9 deletions pkg/notifier/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@ func (a App) getNewReleases(ctx context.Context) ([]model.Release, uint64, error
var releases, helmReleases []model.Release
var releasesCount, helmCount uint64

wg := concurrent.NewFailFast(2)
ctx = wg.WithContext(ctx)
wg := concurrent.NewLimited(2)

wg.Go(func() {
var err error

wg.Go(func() (err error) {
releases, releasesCount, err = a.getNewStandardReleases(ctx)
return
if err != nil {
logger.Error("unable to fetch standard releases: %s", err)
}
})
wg.Go(func() (err error) {

wg.Go(func() {
var err error

helmReleases, helmCount, err = a.getNewHelmReleases(ctx)
return

if err != nil {
logger.Error("unable to fetch helm releases: %s", err)
}
})

if err := wg.Wait(); err != nil {
return nil, 0, err
}
wg.Wait()

return append(releases, helmReleases...), releasesCount + helmCount, nil
}
Expand Down

0 comments on commit 267fbaa

Please sign in to comment.