remove dangling stacktraces
This commit is contained in:
parent
0a83704f19
commit
61ac16c810
1 changed files with 8 additions and 6 deletions
|
@ -15,12 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.faendir.acra.service;
|
package com.faendir.acra.service;
|
||||||
|
|
||||||
import com.faendir.acra.model.App;
|
import com.faendir.acra.model.*;
|
||||||
import com.faendir.acra.model.Bug;
|
|
||||||
import com.faendir.acra.model.QBug;
|
|
||||||
import com.faendir.acra.model.QStacktrace;
|
|
||||||
import com.faendir.acra.model.Stacktrace;
|
|
||||||
import com.faendir.acra.model.StacktraceMatch;
|
|
||||||
import com.mysema.commons.lang.CloseableIterator;
|
import com.mysema.commons.lang.CloseableIterator;
|
||||||
import com.querydsl.core.Tuple;
|
import com.querydsl.core.Tuple;
|
||||||
import com.querydsl.jpa.JPAExpressions;
|
import com.querydsl.jpa.JPAExpressions;
|
||||||
|
@ -46,6 +41,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.faendir.acra.model.QApp.app;
|
import static com.faendir.acra.model.QApp.app;
|
||||||
import static com.faendir.acra.model.QBug.bug;
|
import static com.faendir.acra.model.QBug.bug;
|
||||||
|
import static com.faendir.acra.model.QReport.report;
|
||||||
import static com.faendir.acra.model.QStacktrace.stacktrace1;
|
import static com.faendir.acra.model.QStacktrace.stacktrace1;
|
||||||
import static com.faendir.acra.model.QStacktraceMatch.stacktraceMatch;
|
import static com.faendir.acra.model.QStacktraceMatch.stacktraceMatch;
|
||||||
|
|
||||||
|
@ -163,9 +159,15 @@ public class BugMerger {
|
||||||
@EventListener
|
@EventListener
|
||||||
@Transactional
|
@Transactional
|
||||||
public void onReportsDeleted(ReportsDeleteEvent event) {
|
public void onReportsDeleted(ReportsDeleteEvent event) {
|
||||||
|
deleteOrphanStacktraces();
|
||||||
deleteOrphanBugs();
|
deleteOrphanBugs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void deleteOrphanStacktraces() {
|
||||||
|
new JPADeleteClause(entityManager, stacktrace1).where(stacktrace1.notIn(JPAExpressions.select(report.stacktrace).from(report).distinct())).execute();
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteOrphanBugs() {
|
public void deleteOrphanBugs() {
|
||||||
new JPADeleteClause(entityManager, bug).where(bug.notIn(JPAExpressions.select(stacktrace1.bug).from(stacktrace1).distinct())).execute();
|
new JPADeleteClause(entityManager, bug).where(bug.notIn(JPAExpressions.select(stacktrace1.bug).from(stacktrace1).distinct())).execute();
|
||||||
|
|
Loading…
Reference in a new issue