im85288 / service.upnext

GNU General Public License v2.0
80 stars 41 forks source link

Trying to load setting definitions from old format #262

Closed eddyg closed 2 years ago

eddyg commented 2 years ago

I recently upgraded to 19.1:

2021-08-01 19:47:08.701 T:1441     INFO <general>: CAddonMgr::FindAddons: service.upnext v1.1.5+matrix.1 installed
2021-08-01 19:47:10.207 T:1441    DEBUG <general>: CServiceAddonManager: starting service.upnext
2021-08-01 19:47:12.044 T:1475    DEBUG <CAddonSettings[service.upnext]>: trying to load setting definitions from old format...
2021-08-01 19:47:12.046 T:1474    DEBUG <general>: Skipped 6 duplicate messages..
2021-08-01 19:47:12.046 T:1475    DEBUG <CAddonSettings[service.upnext]>: trying to load setting definitions from old format...
2021-08-01 19:47:12.046 T:1475     INFO <general>: [service.upnext] UpNextMonitor -> Service started

I've noticed the log getting filled with messages like this:

2021-08-01 22:44:50.753 T:1475    DEBUG <CAddonSettings[service.upnext]>: trying to load setting definitions from old format...
2021-08-01 22:45:00.804 T:1475    DEBUG <CAddonSettings[service.upnext]>: Skipped 29 duplicate messages..
2021-08-01 22:45:00.804 T:1475    DEBUG <CAddonSettings[service.upnext]>: trying to load setting definitions from old format...
2021-08-01 22:45:10.854 T:1475    DEBUG <CAddonSettings[service.upnext]>: Skipped 29 duplicate messages..
2021-08-01 22:45:10.854 T:1475    DEBUG <CAddonSettings[service.upnext]>: trying to load setting definitions from old format...
2021-08-01 22:45:20.783 T:4659    DEBUG <general>: Skipped 29 duplicate messages..
kodi:~# grep 'service.upnext.*old format' ~/.kodi/temp/kodi.log | wc -l
862

This is a great service, so hopefully this is something that can be addressed?

Thanks for your time... and a terrific add-on!

dagwieers commented 2 years ago

AFAIK this is not a problem, in debug mode a lot of stuff is being logged that is just internal to Kodi. We do not plan to use the new Kodi settings format just yet.

MoojMidge commented 2 years ago

Leaving aside the new vs old settings format, I think the amount of time UpNext spends checking its own settings could be looked at.

Every time a message is added to the log the settings are checked, and even when UpNext is not doing anything, every second the main polling loop keeps on checking settings to see if it has been disabled. Every time the settings are checked they have to be parsed again. It is just because the old format is being used and debug logging is enabled that this becomes more obvious, but doesn't mean this couldn't be improved.

Should only really be doing this once, and then use the Monitor.onSettingsChanged callback to update settings values if they have actually changed. Example here: https://github.com/MoojMidge/service.upnext/blob/5cde0dd503c0f538df9e51fc9cdfa56833b4d657/resources/lib/state.py#L116-L164 https://github.com/MoojMidge/service.upnext/blob/5cde0dd503c0f538df9e51fc9cdfa56833b4d657/resources/lib/monitor.py#L435-L446

Can create a PR to do the same here?