mirror of
https://github.com/slhaf/Partner.git
synced 2026-10-25 19:03:48 +00:00
fix(impression): correct impression update behavior
This commit is contained in:
@@ -33,15 +33,19 @@ class Entity @JvmOverloads constructor(
|
|||||||
): IndexableData = impressionLock.withLock {
|
): IndexableData = impressionLock.withLock {
|
||||||
if (newImpression == null) {
|
if (newImpression == null) {
|
||||||
impressions.computeIfAbsent(impression) { IndexableData(confidence) }
|
impressions.computeIfAbsent(impression) { IndexableData(confidence) }
|
||||||
.also { it.confidence = confidence }
|
.also {
|
||||||
|
it.confidence = confidence
|
||||||
|
if (it.confidence >= 0.9) {
|
||||||
|
featureLock.withLock { features[impression] = it }
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
impressions.remove(impression)
|
impressions.remove(impression)
|
||||||
IndexableData(confidence).also {
|
IndexableData(confidence).also {
|
||||||
impressions[newImpression] = it
|
impressions[newImpression] = it
|
||||||
}
|
|
||||||
}.also {
|
|
||||||
if (it.confidence >= 0.9) {
|
if (it.confidence >= 0.9) {
|
||||||
featureLock.withLock { features[impression] = it }
|
featureLock.withLock { features[newImpression] = it }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user