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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

reload_data on time intervals #97

Closed
philsch opened this issue Mar 20, 2024 · 5 comments
Closed

reload_data on time intervals #97

philsch opened this issue Mar 20, 2024 · 5 comments
Labels
Feature request New feature or request

Comments

@philsch
Copy link

philsch commented Mar 20, 2024

Hi there,

First, thanks for this project, I really like the clean UI 馃憤

I'm importing my calendar via ics_event_files and want to keep calcure running during the day. Is there any functionality to refresh the data in certain time intervals (e.g. every 15mins) so changed events are reflected automatically?

@anufrievroman
Copy link
Owner

Hi, thank you.

No, but you can manually reload with Q.
Due to the design of the software, it is difficult to implement good auto refresh. Plus, even if it was there, it would cause some troubles if there's no internet or freeze when the ics file is large. So we decided to keep it as manual update.

P.s. if you or someone else would like to work on it, I'll gladly consider good implementations of this feature.

@anufrievroman anufrievroman added the Feature request New feature or request label Mar 20, 2024
@philsch
Copy link
Author

philsch commented Mar 23, 2024

Without doing a bigger change to the current code base, what do you think about the following idea to solve the freeze problem?

  • a new class icalsync.py takes care about downloading all ics files that are located remotely and stores it into ~/.config/calcure/ical, eventually separated in additional subfolders calendars and tasks
    • this process could run as an async thread
    • it takes also a reference of screen to signal that a reload_data is needed
  • the purpose of your existing loader.py slightly changes, it will only read the files that have been stored into the new cache directory ~/.config/calcure/ical, this ensures that the loader will always execute fast enough
    • open for discussion if "local" ics files that are referenced in the config will still be handled by loader.py or if icalsync.py will also take care about those and copy such files into the new cache directory
  • refreshing (downloading again) the data via icalsync.py can be repeated and the reload_data status set when this process has finished in the background

@anufrievroman
Copy link
Owner

Sorry for the delay, I've been thinking about this solution. And while it's a reasonable solution, basically I think it's a bit overkill for a rather niche problem. I'd say, let's just make a simple auto reloading at set time intervals, with 0 (no reload) as the default. I imagine not many people need this feature and even fewer people have such a huge ics files that they need caching, and even if they have, they can wait once in an hour, as it happens passively on the background. Moreover, such people can solve freezing problem by using vdisyncer or other sync solutions. I think calcure should not take advanced syncing functionality at least at this stage.

So, I'll come from vacation next week and will try a simple implementation of this feature, then we can see that maybe it's enough.

anufrievroman added a commit that referenced this issue Apr 3, 2024
Now there is a new parameter that determines how often data is reloaded. This addresses the issue #97
@anufrievroman
Copy link
Owner

anufrievroman commented Apr 3, 2024

Okay, I implemented the data reload on intervals, so that now there is a parameter data_reload_interval = 0 (in minutes, with 0 to switch off) that controls how often data reload. Actually, it's not precise, as the program itself is reloading every 20 seconds, but for our purpose it is precise enough, I think. It is now in the main branch, and will be available in the next release.

@philsch
Copy link
Author

philsch commented Apr 5, 2024

Thanks, that's enough for my working dashboard to update in regular intervals :)

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

No branches or pull requests

2 participants