Merge lp:~cmiller/ubuntuone-android-music/cache-random-list into lp:ubuntuone-android-music

Proposed by Chad Miller
Status: Merged
Merged at revision: 515
Proposed branch: lp:~cmiller/ubuntuone-android-music/cache-random-list
Merge into: lp:ubuntuone-android-music
Diff against target: 0 lines
To merge this branch: bzr merge lp:~cmiller/ubuntuone-android-music/cache-random-list
Reviewer Review Type Date Requested Status
Michał Karnicki (community) Approve
Review via email: mp+68757@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michał Karnicki (karni) wrote :

I was worried about one issue, but I wasn't able to reproduce it (by modifying the code for it to think I have 0 songs), so I may be wrong here. The call to public MusicDirectory getRandomSongs - if user has 0 songs (new user), this will call updateGetRandomSongs with sleepDuration == 0L. I think the second part of the alternative
"""if ((cached == null) || (cached.getChildren().size() == 0))"""
should not cause immediate call to updateGetRandomSongs(), and in turn musicService.getRandomSongs(). If cache is of size 0, it may also mean user has 0 songs and there's no need to refresh (can we somehow tell?).

One silly detail. If ShufflePlayBuffer ln 110 expects songs may be null, I wouldn't include printing the exception stack trace in ln 118 Log.w(TAG, "Failed to refill shuffle-play buffer.", x); -- IMHO if we're anticipating a null value, we shouldn't log "ShufflePlayBuffer W java.lang.NullPointerException" + stack trace -- it just looks terribly in the logs ;) I assume you didn't add an if (songs == null), because you wanted to increase the errorCount in catch clause.

Interesting catch with the project name!

With the first paragraph in mind, well done! +1

review: Approve
Revision history for this message
Chad Miller (cmiller) wrote :

Karni, there is always a problem of staleness in caching an index of songs. If the user had songs in the past, it may be okay to allow the staleness. But, if they had no songs last time, it's more important to try to get something to listen to right now, because they will certainly notice the staleness.

That is intentional, that if there are no songs at all in the cached index, that we try to discover some right away.

Revision history for this message
Chad Miller (cmiller) wrote :

Addressing the shuffle-play-buffer logging stacktraces in a loop.

515. By Chad Miller

Log the name of the exception, but not the stack trace, when failing to refill the shuffle buffer in a loop.

Preview Diff

Empty

Subscribers

People subscribed via source and target branches

to status/vote changes: