mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
Make sure there are no race conditions where etag is known but content just timed out thus resulting in a null response and no cached value to fall back on
This commit is contained in:
parent
580657aed0
commit
eecd53a87d
@ -300,9 +300,9 @@ public class TMDbClient implements MovieIdentificationService {
|
||||
String cacheName = locale.getLanguage().isEmpty() ? getName() : getName() + "_" + locale;
|
||||
|
||||
Cache etagStorage = Cache.getCache(cacheName + "_etag", CacheType.Monthly);
|
||||
Fetch fetchIfNoneMatch = fetchIfNoneMatch(url -> etagStorage.get(key), (url, etag) -> etagStorage.put(key, etag));
|
||||
|
||||
Cache cache = Cache.getCache(cacheName, CacheType.Monthly);
|
||||
|
||||
Fetch fetchIfNoneMatch = fetchIfNoneMatch(url -> cache.get(key) == null ? null : etagStorage.get(key), (url, etag) -> etagStorage.put(key, etag));
|
||||
Object json = cache.json(key, s -> getResource(s, locale)).fetch(withPermit(fetchIfNoneMatch, r -> limit.acquirePermit())).expire(Cache.ONE_WEEK).get();
|
||||
|
||||
if (asMap(json).isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user