aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/service/ActivityPubService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/juick/service/ActivityPubService.java b/src/main/java/com/juick/service/ActivityPubService.java
index 1bf1b5d4..c45b0c13 100644
--- a/src/main/java/com/juick/service/ActivityPubService.java
+++ b/src/main/java/com/juick/service/ActivityPubService.java
@@ -20,6 +20,7 @@ package com.juick.service;
import com.juick.model.User;
import com.juick.model.AnonymousUser;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriComponents;
@@ -58,8 +59,12 @@ public class ActivityPubService extends BaseJdbcService implements SocialService
@Transactional
@Override
public void addFollower(User user, String acct) {
- getJdbcTemplate().update("INSERT INTO followers(user_id, acct) " +
- "VALUES(?, ?)", user.getUid(), acct);
+ try {
+ getJdbcTemplate().update("INSERT INTO followers(user_id, acct) " +
+ "VALUES(?, ?)", user.getUid(), acct);
+ } catch (DuplicateKeyException e) {
+ // ignore
+ }
}
@Transactional