From 0c6e8881c3bce62a0e61b7bb83a702c0c18f3739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 10 Nov 2020 15:07:27 +0100 Subject: [PATCH] fix 820 - race condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- accounts/pkg/command/server.go | 4 ++-- accounts/pkg/service/v0/permissions.go | 4 ++-- changelog/unreleased/fix-820.md | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/fix-820.md diff --git a/accounts/pkg/command/server.go b/accounts/pkg/command/server.go index 781edfc7445..8433a46923f 100644 --- a/accounts/pkg/command/server.go +++ b/accounts/pkg/command/server.go @@ -83,8 +83,8 @@ func Server(cfg *config.Config) *cli.Command { gr.Add(func() error { logger.Info().Str("service", server.Name()).Msg("Reporting settings bundles to settings service") - go svc.RegisterSettingsBundles(&logger) - go svc.RegisterPermissions(&logger) + svc.RegisterSettingsBundles(&logger) + svc.RegisterPermissions(&logger) return server.Run() }, func(_ error) { logger.Info(). diff --git a/accounts/pkg/service/v0/permissions.go b/accounts/pkg/service/v0/permissions.go index 22c5f3b4ff2..62c5668d6cc 100644 --- a/accounts/pkg/service/v0/permissions.go +++ b/accounts/pkg/service/v0/permissions.go @@ -35,9 +35,9 @@ func RegisterPermissions(l *olog.Logger) { res, err := service.AddSettingToBundle(context.Background(), &permissionRequests[i]) bundleID := permissionRequests[i].BundleId if err != nil { - l.Err(err).Str("bundle", bundleID).Str("setting", permissionRequests[i].Setting.Id).Msg("error adding setting to bundle") + l.Err(err).Str("bundle", bundleID).Str("setting", permissionRequests[i].Setting.Id).Msg("error adding permission to bundle") } else { - l.Info().Str("bundle", bundleID).Str("setting", res.Setting.Id).Msg("successfully added setting to bundle") + l.Info().Str("bundle", bundleID).Str("setting", res.Setting.Id).Msg("successfully added permission to bundle") } } } diff --git a/changelog/unreleased/fix-820.md b/changelog/unreleased/fix-820.md new file mode 100644 index 00000000000..67614922d42 --- /dev/null +++ b/changelog/unreleased/fix-820.md @@ -0,0 +1,5 @@ +Bugfix: Make settings service start without go coroutines + +The go routines cause a race condition that sometimes causes the tests to fail. The ListRoles request would not return all permissions. + +https://github.com/owncloud/ocis/pull/835 \ No newline at end of file