Skip to content

Upon restoring from seed phrase, app freezes while processing hundreds of undesirable contacts #21996

Open
@ilmotta

Description

Problem

When restoring from seed phrase a user who has joined the Status community and after first login, the app freezes for a few seconds. Subsequent logins won't cause this issue.

Inspecting the SQL DB reveals that this profile has 800+ contacts in the contacts table, but in reality only a handful were actual contacts. Every contact where the column has_added_us is 0 and column contact_request_state is 0 will be a contact that will generate a re-frame event :activity-center/remove-pending-contact-request. The freeze happens because the CPU hogs while processing 800+ events in sequence (generated from status-im.contexts.chat.contacts.events/process-js-contacts).

The existing solution doesn't scale because a user pays the penalty of the size of communities and end up with potentially thousands of contacts in their local database.

Note: I (@ilmotta) have to yet to investigate if we can improve the implementation in status-go.

Impact

The impact seems to be low because the dramatic performance drop only happens upon first login after restoring, but since Status app should be prepared to handle larger communities, this problem may eventually be quite disruptive to users.

Acceptance Criteria

When restoring a profile, there should be minimal impact to start using the app.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions