aboutsummaryrefslogtreecommitdiffstats
path: root/worker/mbox/worker.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-09-06 07:47:19 -0500
committerRobin Jarry <robin@jarry.cc>2023-09-19 01:16:52 +0200
commitd57aa9e582f1644e2ee260c5c18fbf974dcc03ee (patch)
tree284fad08d1fceb50b4b86d23b39ab919a07bd3a4 /worker/mbox/worker.go
parentb17e8aed7c36f5f5ffc3c490704df78694477370 (diff)
downloadaerc-d57aa9e582f1644e2ee260c5c18fbf974dcc03ee.tar.gz
lib: return a new Header from LimitHeaders
The LimitHeaders function is used to optionally reduce memory usage of aerc by only keeping certain headers in memory for the message list. The function properly deletes header keys and values from the underlying object, however the underlying data structure has a map and a slice - which do not get resized after deletion: resulting in no actual memory savings. Create a new header and add only the headers we want to it. Return this value and use in the MessageInfo struct. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/mbox/worker.go')
-rw-r--r--worker/mbox/worker.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go
index eb622e93..ab853b1c 100644
--- a/worker/mbox/worker.go
+++ b/worker/mbox/worker.go
@@ -174,9 +174,9 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
} else {
switch {
case len(w.headersExclude) > 0:
- lib.LimitHeaders(msgInfo.RFC822Headers, w.headersExclude, true)
+ msgInfo.RFC822Headers = lib.LimitHeaders(msgInfo.RFC822Headers, w.headersExclude, true)
case len(w.headers) > 0:
- lib.LimitHeaders(msgInfo.RFC822Headers, w.headers, false)
+ msgInfo.RFC822Headers = lib.LimitHeaders(msgInfo.RFC822Headers, w.headers, false)
}
w.worker.PostMessage(&types.MessageInfo{
Message: types.RespondTo(msg),