Extension crash on Gnome startup when HASS is not reacheable
Closed this issue · 7 comments
As discussed in #58, On my Debian Bookworm installation (Gnome 44 / GTK4), when I open my session without network, the extension crash and can't be restarted in parameters :
With bad network (on mobile data or bad Wifi for example), it worse because it try to reach HASS for every declared entities and each request blocked the startup for some long delay.
I partially fixed the problem by adding a try/catch in send_request()
(around session.send_and_read()
call) and setting a smaller timeout on session (using session.set_timeout()
), but the main problem is these requests are synchronous. I mean the right way to fix this problem is to refactor the code to use Soup.Session.send_and_read_sync()
and callbacks instead of the synchronous Soup.Session.send_and_read()
.
It's a quite long work I mean due to the impact of this change, so I prefer to ask you your idea on this problem before working on a PR.
Thanks for bringing this up. I guess you mean that we need to use `Soup.Session.send_and_read_async(), right? This would probably solve this issue, but we would need to very carefully design the callback function.
Is this something you can work on? I am very busy lately and I don't use HASS as much as I used to, so it's a bit difficult for me to test and debug.
Thanks for bringing this up. I guess you mean that we need to use `Soup.Session.send_and_read_async(), right? This would probably solve this issue, but we would need to very carefully design the callback function.
Yes, my bad, I'm of course talking about Soup.Session.send_and_read_async()
😄
Is this something you can work on? I am very busy lately and I don't use HASS as much as I used to, so it's a bit difficult for me to test and debug.
Yes, I will try.
I think you are using the extensions.gnome.org version of this which hasn't been updated, yet (due to some issues with formatting that I plan to solve within the next few days). Maybe try installing from the Releases page of this repo.
If that's not the case, then could you explain what ha.octonezd.me
is? Is this the URI you trying to connect to?
Its domain name of my home assistant instance. I will try installing version from releases page and check if issue is still there
Just FYI, I just uploaded a new version on e.g.o. and it should be accepted within the next couple of days.