mherger wrote: 
> > Anyway, since it only affects the -post-scan refresh- I'll try a
> > workaround and add a dedicated post-scan function that calls the
> refresh
> > function unless it's been done in the last 30 seconds or so.
> 
> What I sometimes do in such situations is to 
> Slim::Utils::Timers::setTimer(), and first thing the handler would do 
> _before_ setting the timer, is to kill any current timer for the 
> respective function. That would make sure we only run once in the given
> 
> delay.

It's a different approach.
What I had in mind was: do post-scan refresh unless post-scan refresh
already happened in the last 30 seconds. Users can see the results of
the refresh/import very quickly and won't get confused or think the
ratings import failed. ('code'
(https://github.com/AF-1/lms-ratingslight/blob/main/RatingsLight/Plugin.pm#L1259))

I like the timer solution because it's safe: however many calls happen
within any subsequent 30 secs window it will only take the last one.
Only downside is the final delay of 30 seconds + execution time before
the refresh results are available to the users.
Hard to choose.


------------------------------------------------------------------------
afriend's Profile: http://forums.slimdevices.com/member.php?userid=39306
View this thread: http://forums.slimdevices.com/showthread.php?t=113344

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to