~nicoco/matteridge

c495ce093d89564218b9a33c5f124a378abb9d4a — nicoco 7 months ago f4abac2
fix: dict changed during iteration

since we await in the list comp, sometimes
this error can be raised
1 files changed, 4 insertions(+), 7 deletions(-)

M matteridge/contact.py -rw-r--r-- => -rwxr-xr-x
M matteridge/contact.py => matteridge/contact.py +4 -7
@@ 282,13 282,10 @@ class Roster(LegacyRoster[str, Contact]):

    async def known_user_ids(self, only_friends=False, including_me=True):
        me = await self.mm.mm_id
        r = [
            await c.mm_id()
            for _jid, c in self.session.contacts.known_contacts(
                only_friends=only_friends
            ).items()
            if await c.mm_id() != me
        ]
        known_contacts = self.session.contacts.known_contacts(
            only_friends=only_friends
        ).items()
        r = [await c.mm_id() for _jid, c in known_contacts if await c.mm_id() != me]
        if including_me:
            r.append(me)
        return r