aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2024-05-29 16:46:48 -0500
committerRobin Jarry <robin@jarry.cc>2024-06-04 21:11:16 +0200
commit0465509eedade77954e003a82529435c14cf1f3b (patch)
tree138f6c8eb2497a0c0a1773700337f4ba6761e226 /worker/jmap
parent659069dd1f04dd0573d174125da874b8f0e301fb (diff)
downloadaerc-0465509eedade77954e003a82529435c14cf1f3b.tar.gz
jmap: skip Email/get call if no emails to get
No need to send a JMAP request if there are no object to fetch. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'worker/jmap')
-rw-r--r--worker/jmap/fetch.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/worker/jmap/fetch.go b/worker/jmap/fetch.go
index efa8f69b..3c422cbf 100644
--- a/worker/jmap/fetch.go
+++ b/worker/jmap/fetch.go
@@ -154,6 +154,10 @@ func (w *JMAPWorker) handleFetchMessageHeaders(msg *types.FetchMessageHeaders) e
missing = append(missing, id)
}
+ if len(missing) == 0 {
+ return nil
+ }
+
var req jmap.Request
req.Invoke(&email.Get{
Account: w.accountId,