Hello, I am interested in scheduling my function to run every night at a certain time. I see a section in the console that reads Update CRON Schedule
I was looking through the docs and can't seem to find any information to get started. I never worked with CRON schedules before. Does anyone have an example of a schedule that I can see? Thanks.
Thanks!
What I am trying to do is this: I have a collection made up of Appointments with the attributes ApptDate, ApptStartTime, ApptEndTime, isEditable and some other details about the Appointment I want to have a function run every night to check if an appointment is past the ApptEndTime, if it is make that appointments isEditable field to false. Since there is a limitation of 25 records I can query at a time, is the proper way to do this is get the total documents from the listDocuments endpoint and just do a loop and use the updateDocument endpoint to update the records as needed? Not sure if functions fall into this exception I got from the updateDocument doc This endpoint is limited to 120 requests in every 1 minutes per IP address,
Any advice?
executing functions won't hit rate limit since they use server-side sdk authenticated with an API key
ratelimit is only for client apps
Ok great. So will my logic work getting the total docs and then just using a loop and get the next 25 docs if needed. is that way ok to do? or is there a better way. Thanks again.
that seems like the best way rn considering there's no way to batch update as of now
Hi thank you for the question - attaching some links for your reference
- https://medium.com/@ujjwal26599/leveraging-power-of-appwrite-to-build-scheduling-applications-40615fa7e7f7
- https://appwrite.io/docs/functions#functionVariables (see function. trigger)
- https://appwrite.io/docs/command-line-deployment#function-options (see schedule)
- https://dev.to/appwrite/30daysofappwrite-cloud-function-with-cron-258c
Hope these help you - if not, feel free to post your questions as and when you feel stuck
Thank you for this. I have the cron schedule for my functions set as 17 12 * * *
to execute at 12:17 but it did not work. Not sure why. I did look at your example from here https://dev.to/appwrite/30daysofappwrite-cloud-function-with-cron-258c And I have it set up that way. Any other suggestions?
Do I have to set anything in this section? Update Events
?
It works just the time difference from server and my local machine. Sorry.
[SOLVED] Cloud Function scheduling
I would assume the time is in UTC. is that right? or is it the actual server timezone?
I just can not wrap my head around all the different times. When I log into my ubuntu server and type date
I get back the same time of my local machine Wed Apr 12 16:39:18 EDT 2023
but appwrite must be in UTC.
My function cron schedule says 11 15 * * *
but then when I hover over the time icon on the main functions page i get Next Execution Apr 13, 2023 11:11
What version of Appwrite are you on?
and what's your time compared to UTC?
My time is 17:41 and UTC is 19:41
Looks like I am -4:00
so that looks right then. the cron is in UTC and the next execution is your local time
Yep. I just have to adjust my cron settings and keep in mind of the 4 hr difference.
Just tested the function and it ran as expected with the adjusted cron. Thanks. This thread is officially solved. haha
Recommended threads
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Function in Node.JS to monitor events ar...
Hello everyone. I'm creating my first Node.JS function, but I don't have much experience with node and javascript. I'm trying to create a function, that monito...
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...