From b7731737e1fc735640b6d5311f8c99cbf7be72b7 Mon Sep 17 00:00:00 2001 From: nirav24 Date: Tue, 27 Dec 2022 10:01:04 -0500 Subject: [PATCH] skip emitting * channel twice --- db/design_doc.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/db/design_doc.go b/db/design_doc.go index d44d21a978..d75d92bb80 100644 --- a/db/design_doc.go +++ b/db/design_doc.go @@ -482,9 +482,13 @@ func installViews(ctx context.Context, viewStore sgbucket.ViewStore) error { if (channels) { for (var name in channels) { removed = channels[name]; - if (!removed) + // if EnableStarChannelLog= true and "*" is added because AllDocs index isn't created + // Skip emiting "*" again as above lines has emitted "*" channel + if (name == "*" && %v) // EnableStarChannelLog + continue + if (!removed) { emit([name, sequence], value); - else { + } else { var flags = removed.del ? %d : %d; // channels.Removed/Deleted emit([name, removed.seq], {rev:removed.rev, flags: flags}); } @@ -492,7 +496,7 @@ func installViews(ctx context.Context, viewStore sgbucket.ViewStore) error { } }` - channels_map = fmt.Sprintf(channels_map, syncData, base.SyncDocPrefix, ch.Deleted, EnableStarChannelLog, + channels_map = fmt.Sprintf(channels_map, syncData, base.SyncDocPrefix, ch.Deleted, EnableStarChannelLog, EnableStarChannelLog, ch.Removed|ch.Deleted, ch.Removed) // Channel access view, used by ComputeChannelsForPrincipal()