3157 Catch weird failure at marking threads as read
This commit is contained in:
parent
7a67aac779
commit
64fe65ce80
@ -1,5 +1,6 @@
|
||||
package se.su.dsv.scipro.supervisor.pages;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import org.apache.wicket.Component;
|
||||
import org.apache.wicket.RestartResponseException;
|
||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||
@ -18,6 +19,7 @@ import se.su.dsv.scipro.group.GroupForumThread;
|
||||
import se.su.dsv.scipro.util.PageParameterKeys;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
|
||||
public class SupervisorViewGroupThreadPage extends AbstractSupervisorGroupPage implements MenuHighlightSupervisorMyGroups {
|
||||
|
||||
@ -46,7 +48,20 @@ public class SupervisorViewGroupThreadPage extends AbstractSupervisorGroupPage i
|
||||
|
||||
add(new FeedbackPanel("feedback"));
|
||||
|
||||
basicForumService.setThreadRead(loggedInUser(), groupThread.getForumThread(), true);
|
||||
try {
|
||||
basicForumService.setThreadRead(loggedInUser(), groupThread.getForumThread(), true);
|
||||
} catch (RuntimeException e) {
|
||||
Throwable rootCause = Throwables.getRootCause(e);
|
||||
if (rootCause instanceof SQLIntegrityConstraintViolationException) {
|
||||
// One specific user keep getting weird constraint integrity violations.
|
||||
// All attempts at replication have failed.
|
||||
// To get rid of the error we catch it and ignore it. If we failed to
|
||||
// mark a thread as read because it is already read, it does not matter.
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
add(new ViewForumThreadPanel<>("thread", groupThreadModel, new GroupForumThread(groupForumService)) {
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user