Murzchnvok / polybar-collection

Beautiful collection of Polybar themes
824 stars 47 forks source link

wait for get_weather() to not return None #19

Closed amsesk closed 1 year ago

amsesk commented 1 year ago

I was having an issue on my system where the weather module wasn't displaying on login while using the lofi theme. At the subsequent interval (as defined in themes/lofi/modules/weather.ini), the temperature and icon would suddenly appear. I tracked this down to the get_weather function in scripts/weather/main.py returning None.

In this pull request, I add code that waits for get_weather to return a dictionary of values before proceeding. I did not track down the cause of get_weather returning None shortly after login, so that remains a mystery.

Murzchnvok commented 1 year ago

Heya, thanks for the PR, I'll take a look.

Murzchnvok commented 1 year ago

I really would like to merge the changes, but I'm not sure if I should, because there's an interval of 30 minutes in the weather.ini file, and because the script would be running until it gets a result I'm not sure if this would create another process if the script kept running for some reason (maybe no internet or something related). I do need to make some changes in this code, I forgot to properly handle the exceptions. Thanks again for the PR, I'd suggest to keep the changes you made since it's working for you. BTW just made an update, try and see if it works now!

amsesk commented 1 year ago

That completely makes sense. You're right that in the case of no internet connection that my solution would maintain a totally extraneous process - good point.

I like what you did with the HTTP adapter configured for retries and a sensible timeout period. I imagine f136c19 will fix the issue I was having too, whatever the exact cause was.

Thanks for fixing this up and for maintaining this repo - I didn't really know where to start with polybar config and your repo has really helped contextualize things!