node-red-contrib-ical-events
node-red-contrib-ical-events copied to clipboard
[BUG]: Query blocks node-red flows
Describe the bug Every query of my iCal google calendar blocks the other node-red flows for 15 seconds and the node-red dashboard is not responding. I use a clock with a seconds display on my dashboard and you can see the problem very clearly there and it can always be reproduced.
To Reproduce Steps to reproduce the behavior:
- use the upcoming node
- google calender iCal - preview 12hours
- ouput is ok / correct
Expected behavior The remaining node-red flows should not be blocked by a query
**node-red-contrib-ical-events
- Version 2.2.0
- node-red version 2.2.0
- is it an ical calendar
Hi @ascha191,
may I ask how many events in the calendar are? It must be really huge, if it takes 15 seconds ;) This may take some time to parse all the events, indeed.
I did a short test how NodeRED is reacting on a such long running query. My nextcloud calendar takes 5-6 seconds.
I have no dashboard, so I simple output a Timestamp to the debugging console. I don't know, why the dashboard doesn't update within the 15 seconds on your side... The debugging is responding...
I will take some more time, to check the behavior with a dashboard installed. Please be patient.
Regards, Benjamin
Ok, even with a dashbaord installed, the behavior is the same. At least on my side...
I'm very sorry, that this is happening on your side...
Hi Benjamin! Thanks for your quick answer!
The problem seems to occur even without a dashboard on my config. I tried a different iCal calendar. same problem.
My node-red installation runs on a Raspberry Pi 3 Model B ARM-Cortex-A53 4x 1.2GHz.
Any ideas?
Hi,
I've tested it on my Raspi 4 and NodeJs 12, but also on my Proxmox Server with NodeJs 10,12,14,16 and 17. I always getting a response from my "clock" every second...
I will ask a workmate of mine tomorrow. Perhaps he has an idea ;)
Currently I have no idea, why this is happening on your side... Sorry
It sounds like this from the official Node-RED forum: https://discourse.nodered.org/t/node-red-node-mysql-mysql-query-blocks-node-red/40688. I will have to implement a streaming, if I read it correctly. This may take some time, I'm afraid....
Is your CPU at 100% while querying the calendar data?
cpu usage jumps from about 10% to about 40%
Even with 100% CPU it's not blocking here...
Now I installed node-red on my Windows 11 with 6-core Ryzen CPU and tested the same simple flow. Same result. Time output is blocked for at least 2 seconds.
Node-RED version: v2.2.2 Node.js version: v16.14.0
I see. Let's wait, what my workmate says to this ;)
I don't get it yet 😢
Thanks to @anweber, we've found the problem is a real big ical list. Processing this list takes some time. One thing I will try is to implement Worker Threads, the other thing is to optimize the loading and parsing logic. Both will take some time, unfortunately. As a quick fix, are you able to use a smaller calendar?
Ok. Thank you for your help! Maybe a stupid question: Isn't it possible to pre-filter the ical list when querying it from the server? As a workaround I increased the update cycle.
There is not stupid question 😉 Unfortunately Google (or better all ics/ical Provider) doesn't offer such a option. You can image the .ics file like a Textfile. You can only "download" it completely.
I also have on my list to implement the Google Calendar API. But this will tale even more more time ;)
Might be fixed with the latest version 👍 If not, feel free to comment or reopen it 😉
I've implemented worker threads and called it "experimental features", in order to not break others flows.
https://naimo84.github.io/kalender-events/guide/experimental.html