[banshee] Lastfm: avoid unnecessary wait when submitting successful scrobbles



commit f0fcf24ea69b79aa1fb6aca6b3ccccf0ddbac50f
Author: Phil Trimble <PhilTrimble gmail com>
Date:   Sat Mar 16 21:15:13 2013 +0000

    Lastfm: avoid unnecessary wait when submitting successful scrobbles
    
    In the case where everything was successful but there are still entries in
    the queue to submit, the overall connection state was set to 'Idle'.
    
    This meant that on the next interval we would realize that we had tracks to
    submit and then set the state to 'NeedTransmit'. This was an unnecessary
    interval step and made Banshee wait a bit before attempting to submit the
    rest of the queue.
    
    Signed-off-by: Andres G. Aragoneses <knocte gmail com>

 .../Lastfm/Lastfm/AudioscrobblerConnection.cs      |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs 
b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
index 03a192c..dcad888 100644
--- a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
+++ b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
@@ -314,7 +314,11 @@ namespace Lastfm
                 queue.RemoveRange (0, nb_tracks_scrobbled);
                 queue.Save ();
 
-                state = State.Idle;
+                if (queue.Count > 0) {
+                    state = State.NeedTransmit;
+                } else {
+                    state = State.Idle;
+                }
             } else {
                 // TODO: If error == StationError.InvalidSessionKey,
                 // suggest to the user to (re)do the Last.fm authentication.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]