fix: reduce logs when auto accepting shares fails because the share was already unshared before accepting it

This commit is contained in:
Florian Schade
2024-10-10 10:06:08 +02:00
parent 08b33627b2
commit 9856ef4f83
2 changed files with 19 additions and 2 deletions

View File

@@ -0,0 +1,7 @@
Bugfix: Fix panic when sharing with groups
We fixed a bug which caused a panic when sharing with groups, this only happened under a heavy load.
Besides the bugfix, we also reduced the number of share auto accept log messages to avoid flooding the logs.
https://github.com/owncloud/ocis/pull/10279
https://github.com/owncloud/ocis/issues/10258

View File

@@ -8,6 +8,7 @@ import (
"github.com/cs3org/reva/v2/pkg/events/stream"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/rs/zerolog"
"go-micro.dev/v4/metadata"
"google.golang.org/protobuf/types/known/fieldmaskpb"
@@ -133,8 +134,17 @@ func AutoAcceptShares(ev events.ShareCreated, autoAcceptDefault bool, l log.Logg
continue
}
if resp.GetStatus().GetCode() != rpc.Code_CODE_OK {
l.Error().Interface("status", resp.GetStatus()).Str("userid", uid.GetOpaqueId()).Msg("unexpected status code while accepting share")
if code := resp.GetStatus().GetCode(); code != rpc.Code_CODE_OK {
// log unexpected status codes if a share cannot be accepted...
func() *zerolog.Event {
switch code {
// ... not found is not an error in the context of auto-accepting shares
case rpc.Code_CODE_NOT_FOUND:
return l.Debug()
default:
return l.Error()
}
}().Interface("status", resp.GetStatus()).Str("userid", uid.GetOpaqueId()).Msg("unexpected status code while accepting share")
}
}