From 20a1c797bf28631246b6f382e4d19e408a28c6b7 Mon Sep 17 00:00:00 2001 From: Islam Aleiv Date: Tue, 13 Aug 2024 21:15:30 +0200 Subject: [PATCH] Don't request enc keys if not pending --- internal/db/merge.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/db/merge.go b/internal/db/merge.go index d7d224df3e..defac9cc3b 100644 --- a/internal/db/merge.go +++ b/internal/db/merge.go @@ -404,8 +404,12 @@ func (mp *mergeProcessor) addPendingEncryptionRequest(docID string, fieldName im } func (mp *mergeProcessor) sendPendingEncryptionRequest() { + n := len(mp.pendingEncryptionKeyRequests) + if n == 0 { + return + } schemaRoot := mp.col.SchemaRoot() - storeKeys := make([]core.EncStoreDocKey, 0, len(mp.pendingEncryptionKeyRequests)) + storeKeys := make([]core.EncStoreDocKey, 0, n) for k := range mp.pendingEncryptionKeyRequests { storeKeys = append(storeKeys, k) }