1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

More debug logging

This commit is contained in:
Reinhard Pointner 2016-03-10 11:51:22 +00:00
parent c6cd09b50d
commit ff2b8170a5

View File

@ -76,6 +76,7 @@ public class CachedResource<K, R> implements Resource<R> {
try { try {
ByteBuffer data = retry(() -> fetch.fetch(url, lastModified), retryLimit, retryWait); ByteBuffer data = retry(() -> fetch.fetch(url, lastModified), retryLimit, retryWait);
debug.finest(format("Received %,d bytes", data == null ? 0 : data.remaining()));
// 304 Not Modified // 304 Not Modified
if (data == null && element != null && element.getObjectValue() != null) { if (data == null && element != null && element.getObjectValue() != null) {
@ -84,7 +85,7 @@ public class CachedResource<K, R> implements Resource<R> {
return parse.transform(data); return parse.transform(data);
} catch (IOException e) { } catch (IOException e) {
debug.fine(format("Fetch failed => %s", e)); debug.warning(format("Fetch failed: %s => %s", url, e));
// use previously cached data if possible // use previously cached data if possible
if (element == null || element.getObjectValue() == null) { if (element == null || element.getObjectValue() == null) {
@ -108,6 +109,8 @@ public class CachedResource<K, R> implements Resource<R> {
if (retryCount > 0) { if (retryCount > 0) {
throw e; throw e;
} }
debug.fine(format("Fetch failed: Retry %d => %s", retryCount, e.getMessage()));
Thread.sleep(retryWaitTime.toMillis()); Thread.sleep(retryWaitTime.toMillis());
return retry(callable, retryCount - 1, retryWaitTime.multipliedBy(2)); return retry(callable, retryCount - 1, retryWaitTime.multipliedBy(2));
} }