Closed stream101 closed 8 years ago
Thanks. Yes, let's see how this works out.
This close this issue, right? https://github.com/murraycu/android-galaxyzoo/issues/24
I had to revert this commit because it caused timeouts in volley, as seen below. Did you test this?
04-04 09:47:06.858 3556-3759/com.murrayc.galaxyzoo.app E/android-galaxyzoo: cacheUriToFile(): Exception from request.
java.util.concurrent.ExecutionException: com.android.volley.TimeoutError
at com.android.volley.toolbox.RequestFuture.doGet(RequestFuture.java:117)
at com.android.volley.toolbox.RequestFuture.get(RequestFuture.java:97)
at com.murrayc.galaxyzoo.app.provider.HttpUtils.cacheUriToFileSync(HttpUtils.java:123)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUriToFile(SubjectAdder.java:447)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUriToFileWithNullChecks(SubjectAdder.java:388)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUrisToFiles(SubjectAdder.java:367)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.addSubject(SubjectAdder.java:558)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.addSubjects(SubjectAdder.java:335)
at com.murrayc.galaxyzoo.app.provider.ItemsContentProvider.query(ItemsContentProvider.java:712)
at android.content.ContentProvider.query(ContentProvider.java:1017)
at android.content.ContentProvider$Transport.query(ContentProvider.java:238)
at android.content.ContentResolver.query(ContentResolver.java:491)
at android.support.v4.content.ContentResolverCompatJellybean.query(ContentResolverCompatJellybean.java:29)
at android.support.v4.content.ContentResolverCompat$ContentResolverCompatImplJB.query(ContentResolverCompat.java:57)
at android.support.v4.content.ContentResolverCompat.query(ContentResolverCompat.java:125)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:59)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:37)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.android.volley.TimeoutError
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
04-04 09:47:06.930 3786-3786/com.murrayc.galaxyzoo.app:sync I/android-galaxyzoo: cacheUriToFile(): uriFileToCache=http://zooniverse-static.s3.amazonaws.com/www.galaxyzoo.org/subjects/standard/56f3de625925d90042034509.jpeg
04-04 09:47:06.934 3556-3759/com.murrayc.galaxyzoo.app E/android-galaxyzoo: SubjectAdder.CacheUriToFile(): Exception from HttpUtils.cacheUriToFileSync
com.murrayc.galaxyzoo.app.provider.HttpUtils$FileCacheException: Exception from request.
at com.murrayc.galaxyzoo.app.provider.HttpUtils.cacheUriToFileSync(HttpUtils.java:126)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUriToFile(SubjectAdder.java:447)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUriToFileWithNullChecks(SubjectAdder.java:388)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUrisToFiles(SubjectAdder.java:367)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.addSubject(SubjectAdder.java:558)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.addSubjects(SubjectAdder.java:335)
at com.murrayc.galaxyzoo.app.provider.ItemsContentProvider.query(ItemsContentProvider.java:712)
at android.content.ContentProvider.query(ContentProvider.java:1017)
at android.content.ContentProvider$Transport.query(ContentProvider.java:238)
at android.content.ContentResolver.query(ContentResolver.java:491)
at android.support.v4.content.ContentResolverCompatJellybean.query(ContentResolverCompatJellybean.java:29)
at android.support.v4.content.ContentResolverCompat$ContentResolverCompatImplJB.query(ContentResolverCompat.java:57)
at android.support.v4.content.ContentResolverCompat.query(ContentResolverCompat.java:125)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:59)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:37)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.util.concurrent.ExecutionException: com.android.volley.TimeoutError
at com.android.volley.toolbox.RequestFuture.doGet(RequestFuture.java:117)
at com.android.volley.toolbox.RequestFuture.get(RequestFuture.java:97)
at com.murrayc.galaxyzoo.app.provider.HttpUtils.cacheUriToFileSync(HttpUtils.java:123)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUriToFile(SubjectAdder.java:447)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUriToFileWithNullChecks(SubjectAdder.java:388)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.cacheUrisToFiles(SubjectAdder.java:367)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.addSubject(SubjectAdder.java:558)
at com.murrayc.galaxyzoo.app.syncadapter.SubjectAdder.addSubjects(SubjectAdder.java:335)
at com.murrayc.galaxyzoo.app.provider.ItemsContentProvider.query(ItemsContentProvider.java:712)
at android.content.ContentProvider.query(ContentProvider.java:1017)
at android.content.ContentProvider$Transport.query(ContentProvider.java:238)
at android.content.ContentResolver.query(ContentResolver.java:491)
at android.support.v4.content.ContentResolverCompatJellybean.query(ContentResolverCompatJellybean.java:29)
at android.support.v4.content.ContentResolverCompat$ContentResolverCompatImplJB.query(ContentResolverCompat.java:57)
at android.support.v4.content.ContentResolverCompat.query(ContentResolverCompat.java:125)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:59)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:37)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.android.volley.TimeoutError
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
04-04 09:47:06.934 3556-3759/com.murrayc.galaxyzoo.app E/android-galaxyzoo: onImageDownloadDone(): cacheUriToContentUriFileSync(): failed.
I often couldn't open the image when my wifi is weak, and it turns out the default timeout is too short. So I increase it to 30 seconds as an enhancement.