Skip to content

Discussion: What should be the correct behavior on hibernating browser tabs? #6810

Open
@pubkey

Description

@pubkey

Context

Browser can "hibernate" browser tabs when they are not active. This ensures these tabs do not use any memory or CPU, the JavaScript process on these hibernated tabs is then stopped.

RxDB uses a leader-election for replication so that when many tabs are open, only one tab runs the replication. This saves a lot CPU power and bandwith.

People often reported that they had problems when the elected leader-tab became hibernated by the browser. This seemingly stopped the replication and caused problems.

To prevent this, RxDB added a hack to prevent tab hibernation if at least one replication is running: c2c7ea4
But this hack is not good as it stops the device from power saving when the tab is not in use.

Goal

I will remove this hack in the next release. From my testings, the default behavior of RxDB with hibernating tabs is correct: The hibernated tab dies and a new leader is elected. You can test this behavior with the broadcast channel test-page where the leading tab has a crown-icon in the title. You can manually send tabs to hibernation in chrome at chrome://discards/.

Question

Do you have any way to reproduce a case where the default behavior causes problem?
What do you think the default behavior of RxDB should be?

Related discussions:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions