From dec94017ef96a771402d9046b9e4e344d94b47f9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 10 Jul 2019 17:20:29 +0100 Subject: [PATCH] If there are only a few inbox posts addressed to followers then move them to the individual addresses dict We can afford to do a few extra copies, but not hundreds or thousands --- inbox.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/inbox.py b/inbox.py index 2ab1f067..71ab10a0 100644 --- a/inbox.py +++ b/inbox.py @@ -564,7 +564,18 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [],cache # get recipients list recipientsDict,recipientsDictFollowers= \ inboxPostRecipients(baseDir,queueJson['post'],httpPrefix,domain,port) - recipientsList=[recipientsDict,recipientsDictFollowers] + + # if there are only a small number of followers then process them as if they + # were specifically addresses to particular accounts + noOfFollowItems=len(recipientsDictFollowers.items()) + if noOfFollowItems>0: + if noOfFollowItems<5: + if debug: + print('DEBUG: moving '+str(noOfFollowItems)+' inbox posts addressed to followers') + for handle,postItem in recipientsDictFollowers.items(): + recipientsDict['handle']=postItem + recipientsDictFollowers={} + recipientsList=[recipientsDict,recipientsDictFollowers] if debug: print('*************************************')