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

[Request] Add feature to allow each target calendar to have a different sync refresh #346

Open
mnhim001 opened this issue Jun 14, 2023 · 3 comments · May be fixed by #372
Open

[Request] Add feature to allow each target calendar to have a different sync refresh #346

mnhim001 opened this issue Jun 14, 2023 · 3 comments · May be fixed by #372
Labels
enhancement New feature or request

Comments

@mnhim001
Copy link

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

I currenlty have 4 calendars. 3 Calendars are updated a few times during the month because all the events in those calendars are recurring events. I hae 1 calendar that updates on the fly, and would like that specific calendar to update more frequently, maybe every 5 minutes.

So in other words, if the frequency for the other calendars are left as default, then it would use the script default of 15 minutes. Otherwise, a frequency would be added along with the source calendars.

Additional context

No response

@jonas0b1011001
Copy link
Collaborator

You can set up multiple copys of the script with different sync intervals.

@Lonestarjeepin
Copy link
Collaborator

Lonestarjeepin commented Aug 18, 2023

@jonas0b1011001 and @derekantrican, I'd love your thoughts on this. As I was working on the code for Issue #255, I started working on something for this request too, but I couldn't get the pieces to fall into place. I got inspiration from the "arguments" that are in the sourceCalendars... e.g. "URL", "Target Calendar", "colorID". So I started thinking, what if I just kept adding arguments like frequency (5,10, 60, etc.). However, that would require the entire script to be run on one trigger (say 5 minutes), but each individual calendar may or may not get run during that trigger event. The biggest problem I couldn't solve was getting the script to process each sourceCalendar entry individually instead of merging them together into a target calendar. I got close many times, but again, my Javascript is pretty bad and I couldn't get it over the finish line. If I could get that to work, then it felt like we would need two modifications to make the idea work. 1. Add an argument for "Calendar Name" which would need to be unique for each source calendar then use this in the fromGAS statement so there wouldn't be any conflicts with which sourceCalendar wrote to that targetCalendar. 2. Add an argument for frequency in each sourceCalendar entry, but also a way to track the last run time of that entry. Then in the loop, check to see if current time minus last run time is greater than the frequency argument and run startSync on that source calendar if it is. If not, just ignore it until the next run.

Then I started thinking about other issues that have been raised about "Include only where Subject=xxx" or "Exclude where xxx" and thought these calendar-level arguments could be an enabler for those functions as well. There's probably a cleaner way to variablize those inputs instead of having them all on one row for a given entry, but I at least wanted to throw out the concept. Sorry I couldn't contribute any code for this solution though!

@Lonestarjeepin Lonestarjeepin added the enhancement New feature or request label Sep 14, 2023
@Lonestarjeepin
Copy link
Collaborator

I just submitted a pull request (#372 ) called Sync Delay which addresses this Issue.

@Lonestarjeepin Lonestarjeepin linked a pull request Sep 29, 2023 that will close this issue
@Lonestarjeepin Lonestarjeepin linked a pull request Sep 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants