premnirmal / StockTicker

A resizable widget that shows your financial portfolio on your android home screen
GNU General Public License v3.0
440 stars 116 forks source link

Start fetching time seems to be ignored #333

Closed muziofg closed 11 months ago

muziofg commented 1 year ago

Describe the bug

I'm on UTC+2 now, and I have defined a large period to fetching data: from 9:00 (UTC+2) to 22:15 (UTC+2), to monitor both EU and US markets. I have see a strange behaviour and then I have noticed a bug. Before EU markets opens, the app retriving data start from 00:00. I have disciovered this because near 06:30 yahoo makes a reset of some indexes and app sent me a Notification. This shouldn't happen if app starts fetching at 09:00

To Reproduce Steps to reproduce the behavior:

  1. Settings start time at 9:00 (UTC+2 or equivalent)
  2. Settings stop time at 22:15 (UTC+2 or equivalent)
  3. Wait to the next day , it starts after 00:00 (my local time)
  4. Check last fetching data on the app/widget header, check it before the the start time defined

Expected behavior Data must be retrieved when time is in the specified range

Screenshots immagine

Smartphone (please complete the following information):

Edit 2023/05/22: I don't know what happens, but last update (3.9.822) has worsened the issue. Now the app Ignores stop time, fetching data after the stop time (22:15 UTC+2 for me) Fetching data aggressively, ignoring the interval setted (15 min, for me) when a widget is showed (previously it only happened when you open the app). _ Also, for a strange behaviour, sometimes fetching request seems to be queued and executed all at the same time, causing a flicker for the widgets

I think the app must:

Respect the limits (days and range of hours) setted for the automatic fetching App should respect the interval setted. Do not fetching data aggressively, nor when showing widget neither when the app/wallet is opened. The user already can be do a manual update. Eventually this can be temporary enabled by a switch on the panel that is resetting when the panel is no longer in foreground.

These reasonable suggestions can avoid that an user end up getting ban on his IP address, avoiding stressing the repository and also solves/mitigates the issue https://github.com/premnirmal/StockTicker/issues/304

Edit 2023/05/24: Version 3.9.823 I haven't seen aggressive fetching, but app still ignores start and end times, fetching data 24h/day with the interval setted

Edit 2023/5/28: Version 3.9.825 app still ignores start and end times, also ignores not trading days, fetching data 24h/day with the interval setted

muziofg commented 11 months ago

I don't know kotlin, but what i see in "fun msToNextAlarm @ AlarmScheduler.kt" it's an intricate system of mirrors and levers to determine the next time to schedule an event. I think it's a bit simpler scheduling always event in the next $_USER_DEFINED_INTERVAL_TIME and only when it is triggered determine if there is a job to do or skip to next schedule