Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Can you increase the sync timeout (to save energy)? #3470

Open
mcg-matrix opened this issue May 9, 2020 · 1 comment
Open

Can you increase the sync timeout (to save energy)? #3470

mcg-matrix opened this issue May 9, 2020 · 1 comment

Comments

@mcg-matrix
Copy link

I am using Riot.im 0.9.10 installed from F-Droid; it's the latest version currently offered to me for installation.

The app is configured use the "Background Sync Mode" called "Optimized for battery". (The other mode, called "Optimized for real time", doesn't work for me regarding notifications.)

Here's what I have observed:

  • When the app is running and waiting for something to happen, it sends an HTTP request GET /_matrix/client/r0/sync?timeout=30000&filter=... to the home-server. The home-server will reply as soon as something happened, latest after 30 seconds (presumably telling the app that nothing has happened).
  • If the home-server does not reply to the request within 60 seconds, the app apparently gives up (and tears down the TCP connection).
  • If I modify such requests using a proxy, increasing the value of the "timeout" argument, and slow down the app so it will not run into its 60-seconds-timeout before the home-server replies, everything still works perfectly, up to a maximum value for the "timeout" argument of about 180'000 (milliseconds, i.e. 3 minutes), which appears to be some limit in the home-server/infrastructure run by Modular.

If the value of the "timeout" argument was configurable in the "Optimized for battery" mode (and the 60-seconds-timeout adjusted accordingly), my phone should instantly use 80% less energy for Matrix while nothing happens: I would set the value to ~179 seconds, and the app would place 1 request instead of 6 for every 3 minutes.

For me, I'd expect zero disadvantages resulting from such change. I admit there's a risk that notifications will arrive with a delay of up to the adjusted 60-seconds-timeout in case of a TCP connection silently gone dead, but I'd be happy to take that small risk. :-)

@mcg-matrix
Copy link
Author

If the value of the "timeout" argument was configurable in the "Optimized for battery" mode ...

The Matrix-client app "Element" supports this since its version 1.0.7 brought along element-hq/element-android#2080.

(and the 60-seconds-timeout adjusted accordingly), my phone should instantly use 80% less energy for Matrix while nothing happens ...

After a fix to the 60-seconds-timeout (element-hq/element-android#2169), my phone uses ~50% less energy for running "Element" in version 1.0.11 (with timeout 1777 seconds) compared to before 1.0.7.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant