@@ -91,7 +91,6 @@ import org.litote.kmongo.regex
91
91
import org.litote.kmongo.replaceOneWithFilter
92
92
import org.litote.kmongo.setTo
93
93
import org.litote.kmongo.setValue
94
- import org.litote.kmongo.toId
95
94
import org.litote.kmongo.updateMany
96
95
import java.time.Duration
97
96
import java.time.Instant
@@ -206,16 +205,16 @@ internal object ClassifiedSentenceMongoDAO : ClassifiedSentenceDAO {
206
205
207
206
if (ttlIntents.isNotEmpty() && ttlDays != - 1L ) {
208
207
logger.info { " add classified sentence periodic crawler for $ttlDays days and intents $ttlIntents " }
209
- injector.provide<Executor >().setPeriodic(Duration .ofDays(1 )) {
210
- logger.debug { " delete old classified sentences for intents $ttlIntents " }
208
+ injector.provide<Executor >().setPeriodic(Duration .ofMinutes(1 ), Duration .ofDays(1 )) {
211
209
val intentIds = IntentDefinitionMongoDAO .getIntentsByNames(ttlIntents).map { it._id }
212
- c.deleteMany(
210
+ val deleted = c.deleteMany(
213
211
and (
214
212
Status eq inbox,
215
213
Classification_ .intentId `in ` intentIds,
216
214
UpdateDate lt now().minus(ttlDays, ChronoUnit .DAYS )
217
215
)
218
216
)
217
+ logger.debug { " delete ${deleted.deletedCount} old classified sentences for intents $ttlIntents of ids $intentIds " }
219
218
}
220
219
}
221
220
@@ -406,10 +405,10 @@ internal object ClassifiedSentenceMongoDAO : ClassifiedSentenceDAO {
406
405
private fun SentencesQuery.filterLanguage () = if (language == null ) null else Language eq language
407
406
408
407
private fun SentencesQuery.filterMaxIntentProbability (): Bson ? =
409
- if (maxIntentProbability < 1f ) LastIntentProbability lt maxIntentProbability.toDouble() else null
408
+ if (maxIntentProbability < 1f ) LastIntentProbability lt maxIntentProbability.toDouble() else null
410
409
411
410
private fun SentencesQuery.filterMinIntentProbability (): Bson ? =
412
- if (minIntentProbability > 0f ) LastIntentProbability gt minIntentProbability.toDouble() else null
411
+ if (minIntentProbability > 0f ) LastIntentProbability gt minIntentProbability.toDouble() else null
413
412
414
413
// ugly
415
414
private fun subEntityTypeQuery (entityType : String ): Bson =
0 commit comments