Cover photo
Matthew Bishop
Lives in Salt Lake City, Utah
620 followers|48,075 views


Matthew Bishop

Discussion  - 
I installed Android5.1_NXCM_R3.0_MotoX2014 on my XT1095. But now it won't connect to mobile data. Any ideas about what I should do? Also, if there's a better place for me to post about this (Github issue or something?) let me know.
Matthew Bishop's profile photoMarco Alexis Zacarias Rubio's profile photo
T-Mobile 4G LTE APN
Nombre: de Tmobile
MMS Proxy:
MCC: 310
MNC: 260
Tipo de APN: default
 ·  Translate
Add a comment...
Merge a fetch & into request?

I was wondering if this is already possible, and if not how difficult it might be to add.

I have an "infinite scrolling" style view pager that shows user profiles. On each profile page is relatively large (say 500x500 pixels on a Nexus 4) image of the user. As the user approaches the end of the already loaded profiles, I make a request for an additional set of profiles. When I receive the additional profiles, I go through and use Picasso to *fetch* the images for all the users I just downloaded.

Then, when the user swipes into the new set of users I use Picasso like normal to load the images *into* a Target. Hopefully they should now be cached either in memory or on disk, so this is fast.

I don't fully understand the internals -- but it seems like if the user gets to new profiles before the fetch has completed, a new request is made instead of piggy backing off of the (probably nearly completed) fetch request.

So my question: is there any way to "merge" the *fetch* and *into* requests so that the prefetching doesn't get dropped on the floor?

By the way, does this question make any sense or is there a better way to achieve what I'm looking for?
Jake Wharton's profile photoDimitris Koutsogiorgas's profile photoDandre Allison's profile photoMatthew Bishop's profile photo
Hi +Dimitris Koutsogiorgas and +Jake Wharton, this might be a little too device / situation specific for you to answer, but the *tl;dr; is that I added logging to OkHttpDownloader and I'm getting results like*:

D/OkHttpDownloader(23322): OkHttpDownloader.load(Uri =
D/OkHttpDownloader(23322): took 22206 milliseconds
D/OkHttpDownloader(23322): From CACHE 200

This is an image that I prefetched, so basically it's taking 22 seconds to load a 320x320 image from the cache. That seems unusual to me. Plus if for some reason that's hitting the network it's on WiFi so that still seems slow for such a small image.

I wish I could use Traceview to figure out exactly what the problem is -- unfortunately it's manifesting itself on the only device used by my client (a Nexus S). By the way, I don't see the same problem on my Nexus One (which is more than a year older than the Nexus S), so I don't think it's simply device performance related.

I checked out the master branch from Github and added some logging to OkHttpDownloader to see if the problem is in the network, or OkHttp, or somewhere else (i.e my code). Logging code & and example of the problem from the logs I had the client send me:

Notice the recvfrom failed: ECONNRESET (Connection reset by peer) exception? Does that just mean my client is on a really shitty connection? And obviously there are some slow network requests in there:

D/OkHttpDownloader(23322): OkHttpDownloader.load(Uri =
D/OkHttpDownloader(23322): took 26232 milliseconds
D/OkHttpDownloader(23322): From NETWORK 200

But there's also slow cache calls too, like the first one I showed you or this one:

D/OkHttpDownloader(23322): OkHttpDownloader.load(Uri =
D/OkHttpDownloader(23322): took 10031 milliseconds
D/OkHttpDownloader(23322): From CACHE 200

Basically -- can I just chalk this up to a slow device and slow network connection or could there be something more happening (especially with the disk cache)?
Add a comment...

Matthew Bishop

Shared publicly  - 
One of those great This American Life podcasts. Makes me wanna give them money (again).
Alexis Ohanian originally shared:
The more light we can shine on this broken patent system, the better. Software patents suck.
Jase Cutler's profile photoJessi Sawyer's profile photoMatthew Bishop's profile photo
Ha, +Jessi Sawyer , where do you get your non-rage-inducing news? It would be good for my stress levels and blood pressure.
Add a comment...
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Salt Lake City, Utah
Nampa, Idaho - Salt Lake City, Utah
Basic Information