Skip to content

Commit

Permalink
Don't attach errors when fetching fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Sep 26, 2024
1 parent 3893de1 commit 816ad8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/jasper/component/FileCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.micrometer.core.annotation.Timed;
import jasper.domain.Ref;
import jasper.errors.NotFoundException;
import jasper.errors.ScrapeProtocolException;
import jasper.plugin.Cache;
import jasper.repository.RefRepository;
import jasper.repository.filter.RefFilter;
Expand Down Expand Up @@ -143,6 +144,8 @@ public Ref fetch(String url, String origin, OutputStream os, boolean refresh) {
return tagger.internalPlugin(url, origin, "_plugin/cache", cache, "-_plugin/delta/cache");
}
return tagger.internalPlugin(url, origin, "_plugin/cache", cache);
} catch (ScrapeProtocolException e) {
throw e;
} catch (Exception e) {
tagger.attachError(origin,
tagger.internalPlugin(url, origin, "_plugin/cache", null, "-_plugin/delta/cache"),
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/jasper/component/delta/AsyncCacheScraper.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ void init() {
public void run(Ref ref) throws Exception {
logger.info("{} Caching {}", ref.getOrigin(), ref.getUrl());
tagger.tag(ref.getUrl(), ref.getOrigin(), "-_plugin/delta/cache", "_plugin/cache");
fileCache.refresh(ref.getUrl(), ref.getOrigin());
try {
fileCache.refresh(ref.getUrl(), ref.getOrigin());
} catch (Exception e) {
tagger.attachError(ref.getOrigin(),
tagger.internalPlugin(ref.getUrl(), ref.getOrigin(), "_plugin/cache", null, "-_plugin/delta/cache"),
"Error Fetching", e.getMessage());
}
}
}

0 comments on commit 816ad8c

Please sign in to comment.