Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Refresh Control #913

Open
DeMoN100 opened this issue Jun 13, 2024 · 4 comments
Open

[FEATURE] Refresh Control #913

DeMoN100 opened this issue Jun 13, 2024 · 4 comments

Comments

@DeMoN100
Copy link

The Amethyst app consumes too much battery usage & is burning the battery on my phone. The issue that causes this is the global feed's refresh rate. The more relays you add to your profile the more request are sent out which burns your battery faster since every relay added is getting a getfetch the constant request to refresh the global feed is what makes the battery run hot & burn.

The solution to this would be to add a setting which allows the user to control the refresh interval with multiple options.
Example the user would go to settings & would see a option called refresh control with a menu of choices to set to. The choices on the menu would be Always (constant), every 15 minutes, every 30mins, every 60mins, & custom where the user can manually input their own interval in time format which can be recognized.

Example of custom inputs
24h, 3h 40m, & 3d 4h 24m 32s.
d=days
h=hours
m=minutes
s=seconds

Adding a refresh control will save the battery on peoples phones lets make this a priority because I can't keep using amethyst on mobile if it's going to drain my battery from 100% to 0 multiple times a day.

@vitorpamplona
Copy link
Owner

The issue that causes this is the global feed's refresh rate.

Did you test this? Is it just an assumption or did you validate this somehow?

The global feed is disabled unless you are into that Global feed from the top navigation bar. The follows feed is minimal because it only loads from select authors.

That being said, if the app is in the foreground, it is always connected with all the relays on your relay list. That is needed to bring notifications from any of the relay.

On top of that, Amethyst loads quotes, profile pictures, @ citations and so on only when you see the post in the screen. This means that if you stop being connected, the majority of the posts simply won't load. It's impossible to load all the posts for all parts of the app from the beginning, so we need to do this gradually as you scroll through the feed.

So, most of the connectivity use is to load the rest of the post as you navigate through them.

If you leave the app running, but don't scroll anything, then most relays will close the connection in about 1 minute and the app will stay off until you scroll or change screens again.

@DeMoN100
Copy link
Author

DeMoN100 commented Jun 13, 2024

The issue that causes this is the global feed's refresh rate.

Did you test this? Is it just an assumption or did you validate this somehow?

Well I tried with less relays & adding more relays I removed all my relays keeping it down to 1 then kept pulling feed for a day then compared it to 25 relays pulling I can say the battery drains faster more the more relays you add.

The global feed is disabled unless you are into that Global feed from the top navigation bar. The follows feed is minimal because it only loads from select authors.

I am always in the global first & follows second of course follows uses less but still the request is constant when your in it.

That being said, if the app is in the foreground, it is always connected with all the relays on your relay list. That is needed to bring notifications from any of the relay.

This is the problem constant request there is no manual refresh or control for intervals what if 10 post load & I don't want it to constantly keep pulling from relays because I am scrolling & want it to pull new posts from the relay an hour from now not as I'm constantly scrolling.

On top of that, Amethyst loads quotes, profile pictures, @ citations and so on only when you see the post in the screen. This means that if you stop being connected, the majority of the posts simply won't load. It's impossible to load all the posts for all parts of the app from the beginning, so we need to do this gradually as you scroll through the feed.

Only when you see the post on screen okay well this is once the post is already pulled from the relay to be brought to your global. The issue is the constant request from relays to keep loading post to your global feed as you scroll. Just because I choose to swipe up or down should not be constantly asking the relays to pull new posts & load them to my global. This is what is most likely causing the burning battery.

Creating a setting to set the requests manually will help fix this issue & will probably save you from having to do specific tweaks for specific devices at least I hope. At least that way people who don't mind how it is not can keep it that way & people who feel their phones are burning like mine can get a cooldown option.

@vitorpamplona
Copy link
Owner

vitorpamplona commented Jun 13, 2024

should not be constantly asking the relays to pull new posts & load them to my global

Maybe we need a specific feed for Global. Or you can try to use a proxy relay for Global. If you have 25 active relays for global, you will download the same note, replies, likes, zaps, user metadata, etc 25 times. Not only on global but for all feeds and features of the app. That's probably what's using the battery. The Global Feed with 25 relays will download each note 25 times (which is not a lot), but every reply, zap, like, report, user name etc will ALSO be downloaded 25 times for each.

Meaning, even if we do design something that doesn't update the feed, it will still use significant bandwidth to download the items for each post.

We recommend keeping between for 8-12 relays.

Just because I choose to swipe up or down should not be constantly asking the relays to pull new posts & load them to my global

It's not asking for new posts when you scroll, just likes, zaps, reports, replies, and all the metadata related to the post you are viewing and all of the people involved in the same post. This has to happen otherwise you are not going to see people's names on the post, just @npub...

@DeMoN100
Copy link
Author

should not be constantly asking the relays to pull new posts & load them to my global

Maybe we need a specific feed for Global. Or you can try to use a proxy relay for Global. If you have 25 active relays for global, you will download the same note, replies, likes, zaps, user metadata, etc 25 times. Not only on global but for all feeds and features of the app. That's probably what's using the battery. The Global Feed with 25 relays will download each note 25 times (which is not a lot), but every reply, zap, like, report, user name etc will ALSO be downloaded 25 times for each.

Maybe I am not sure how that will work out I would just have to try & test it once it's implemented. I get it each relay added is getting the posts from each other. I guess as a temporary solution I can cut down the relays I am tied to but I really feel I shouldn't have to because I am trying to make my post reach out to all these relays. I could stop their feeds sure but if I wanted to keep them all going then yes it's a guzzler.

If I have to cutdown relays can there be a import export relay list option built into the app because I really don't want to have to manually type in all these relays again.

Meaning, even if we do design something that doesn't update the feed, it will still use significant bandwidth to download the items for each post.

Right when I choose to refresh it or set it to auto refresh like once every 24 hours for example that is fine.

It's not asking for new posts when you scroll, just likes, zaps, reports, replies, and all the metadata related to the post you are viewing and all of the people involved in the same post. This has to happen otherwise you are not going to see people's names on the post, just @npub...

Oh I thought you meant before when you scroll it is asking the relays to pull new posts then as they load onto your feed then the next request is for everything else loads like zaps, reports, replies, and all the metadata related to the post to load once it's fetched & on your feed.

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

No branches or pull requests

2 participants