[IceTV] Unnecessary updates on unchanged timers

Issue #710 resolved
prl created an issue

Whenever IceTV sends a complete list of a device's recording timers, all timers in the list are updated (doing a delete/post transaction pair with the IceTV server), even if the timer details in the IceTV timer creation request are the same as those in the Beyonwiz timer.

This seems to only happen if either the user does a "resend all timers" from the IceTV server end, or if the try around the code block self.getShows() catches an exception.

According to Daniel Hall@IceTV, a complete timer list is intended to be sent whenever a getShows() is run with last_update_time set to 0, but it does not send a complete timer list.

There appears to be a further bug associated with this issue in that sometimes the timer being updated has its ice_timer_id set to None, but it is not deleted.

The cause of the main bug is due to:

                                if self.updateTimer(timer, ...):
                                    ...
                                else:
                                    self.onTimerChanged(timer)

in EPGFetcher.processTimer(). The if should not have an else clause.

Replication steps

The bug is hard to replicate in unmodified code and was found by analysis of IceTV server logs (mainly by Daniel).

It can be demonstrated by modifying EPGFetcher.doWork() to fall through to the try block surrounding the call of self.getTimers() even if getShows() does not trigger an exception. Adding debug prints can clarify what happens.

Comments (3)

  1. Peter Urbanec

    The if should not have an else clause.

    Is it possible that the else clause should have been indented one more level?

  2. prl reporter

    No, I'm pretty sure that the indent is correct.

    But the else clause shouldn't be empty. If it is, when "Resend all recordings for this device" is done, resent unchanged timers won't be acknowledged and won't change their web page state from "Queued recording" to "Recording". The else clause should be something like:

                                    if self.updateTimer(timer, ...):
                                        ...
                                    else:
                                        iceTimer["message"] = "Timer already up to date '%s'" % name
                                        update_queue.append(iceTimer)
    
  3. Peter Urbanec

    Fix Bug #710: [IceTV] Unnecessary updates on unchanged timers

    [plugin] In EPGFetcher.processTimers(), instead of calling onTimerChanged(timer) when an IceTV timer update leaves the timer unchanged, simply mark the timer as in "pending" state, give it a message that indicates that the timer was already up to date, and queue the response.

    This prevents unnecessary delete/re-create operations on IceTV timer when an IceTV update on a timer doesn't change the timer.

    [API] Update the version datestamp.

    → <<cset 64f812709b6d>>

  4. Log in to comment