From 714779c719894a07156964f66591352498a4597b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 26 Jun 2023 08:30:46 +0300 Subject: ActivityPub: cache all profile exception paths --- src/main/java/com/juick/service/ActivityPubService.java | 4 ++-- src/main/java/com/juick/www/api/activity/Profile.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/service/ActivityPubService.java b/src/main/java/com/juick/service/ActivityPubService.java index 3f56c40c..c2d3f1e7 100644 --- a/src/main/java/com/juick/service/ActivityPubService.java +++ b/src/main/java/com/juick/service/ActivityPubService.java @@ -127,7 +127,7 @@ public class ActivityPubService extends BaseJdbcService implements SocialService getJdbcTemplate().update("DELETE FROM followers WHERE acct=?", acct); } - @Cacheable("profiles") + @Cacheable(value = "profiles", key="#contextUri") public Optional get(URI contextUri) { Instant now = Instant.now(); String requestDate = DateFormattersHolder.getHttpDateFormatter().format(now); @@ -150,7 +150,7 @@ public class ActivityPubService extends BaseJdbcService implements SocialService return Optional.of(context); } } - } catch (IOException e) { + } catch (Exception e) { logger.warn("HTTP Signature exception reading {}: {}", contextUri.toASCIIString(), e.getMessage()); } return Optional.empty(); diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java index 0a6726ee..aa8f0394 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -279,7 +279,6 @@ public class Profile { (currentUrl, nextUrl) -> String.format("%s\n%s", currentUrl, nextUrl)); } - @CacheEvict(cacheNames = "profiles", key = "{ #visitor.uri }") @PostMapping(value = "/api/inbox", consumes = { Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE }) public ResponseEntity processInbox(@Parameter(hidden = true) User visitor, InputStream body) -- cgit v1.2.3