Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
47 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
grails-app/migrations/20172703_remove_latest_not_null_constraint.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
databaseChangeLog = { | ||
|
||
changeSet(author: "peh (generated)", id: "1490609684437-1") { | ||
dropNotNullConstraint(columnDataType: "bigint", columnName: "latest_id", tableName: "entry_group") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package errbuddy | ||
|
||
import grails.transaction.Transactional | ||
|
||
@Transactional | ||
class EntryCleanupService { | ||
|
||
def jesqueService | ||
|
||
void handleEntryCleanupForApplication(App app) { | ||
int max = 10000 | ||
def entries = Entry.createCriteria().list([max: max]) { | ||
entryGroup { | ||
eq('app', app) | ||
} | ||
projections { | ||
property('id') | ||
property('dateCreated') | ||
} | ||
} as List | ||
|
||
def toDelete = entries.findAll { it[1].isBefore(app.clearUntil) }.collect { it[0] }.flatten() | ||
if (!toDelete) { | ||
return | ||
} | ||
|
||
log.info "deleting ${toDelete.size()} entries for $app.name" | ||
toDelete.each { long entryId -> | ||
jesqueService.enqueue(EntryDeleteJob.queueName, EntryDeleteJob, [entryId, true]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters