mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-11-10 10:13:46 +00:00
fix in plugin of ratings gc
This commit is contained in:
parent
69320a3b62
commit
0f958f94cb
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 0.5.6
|
## 0.5.6
|
||||||
|
|
||||||
|
* `Ratings`:
|
||||||
|
* `GC`:
|
||||||
|
* Now GC will autoclear ratings even if post is absent in posts repo
|
||||||
|
|
||||||
## 0.5.5
|
## 0.5.5
|
||||||
|
|
||||||
* Dependencies update
|
* Dependencies update
|
||||||
|
@ -62,7 +62,9 @@ object Plugin : Plugin {
|
|||||||
suspend fun doAutoClear() {
|
suspend fun doAutoClear() {
|
||||||
val dropCreatedBefore = DateTime.now() - (autoclear.skipPostAge ?: 0).seconds
|
val dropCreatedBefore = DateTime.now() - (autoclear.skipPostAge ?: 0).seconds
|
||||||
ratingsRepo.getPostsWithRatingLessEq(autoclear.rating).keys.forEach {
|
ratingsRepo.getPostsWithRatingLessEq(autoclear.rating).keys.forEach {
|
||||||
if ((postsRepo.getPostCreationTime(it) ?: return@forEach) < dropCreatedBefore) {
|
val postCreationDateTime = postsRepo.getPostCreationTime(it) ?: (dropCreatedBefore - 1.seconds) // do dropping if post creation time is not available
|
||||||
|
if (postCreationDateTime < dropCreatedBefore) {
|
||||||
|
ratingsRepo.unset(it)
|
||||||
postsRepo.deleteById(it)
|
postsRepo.deleteById(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user