Skip to content

Commit

Permalink
Økte minnemengden pluss fikset sortering i merge detector
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsmsa committed Oct 29, 2024
1 parent 94d911a commit dbdcdeb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/kafka-key-generator/nais/nais-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ spec:
max: 2
resources:
limits:
memory: 512Mi
memory: 4096Mi
requests:
cpu: 50m
memory: 256Mi
memory: 4096Mi
liveness:
path: /internal/isAlive
initialDelay: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class KafkaKeys(private val database: Database) {
IdentitetTabell
.selectAll()
.where { IdentitetTabell.kafkaKey greaterEq currentPos and (IdentitetTabell.kafkaKey less (currentPos + maxSize)) }
.orderBy(column = IdentitetTabell.kafkaKey, order = SortOrder.DESC)
.orderBy(column = IdentitetTabell.kafkaKey, order = SortOrder.ASC)
.limit(maxSize)
.associate {
Identitetsnummer(it[IdentitetTabell.identitetsnummer]) to ArbeidssoekerId(it[IdentitetTabell.kafkaKey])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fun Routing.konfigurereHelse(
get("/internal/metrics") {
call.respond(prometheusMeterRegistry.scrape())
}
/*get("internal/mergeDetector") {
get("internal/mergeDetector") {
call.respondText(
mergeDetector
.findMerges(900)
Expand All @@ -32,5 +32,5 @@ fun Routing.konfigurereHelse(
.onLeft { mergeLogger.error("Error: ${it.system}:${it.code}", it.exception) }
.fold( { "Error: ${it.system}:${it.code}" }, { it } )
)
}*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import no.nav.paw.kafkakeygenerator.pdl.PdlIdentitesTjeneste
import no.nav.paw.kafkakeygenerator.vo.ArbeidssoekerId
import no.nav.paw.kafkakeygenerator.vo.Identitetsnummer
import no.nav.paw.pdl.graphql.generated.hentidenter.IdentInformasjon
import org.slf4j.LoggerFactory

class MergeDetector(
private val pdlIdentitesTjeneste: PdlIdentitesTjeneste,
private val kafkaKeys: KafkaKeys
) {
private val logger = LoggerFactory.getLogger("MergeDetector")

suspend fun findMerges(batchSize: Int): Either<Failure, Long> {
require(batchSize > 0) { "Batch size must be greater than 0" }
return kafkaKeys.hentSisteArbeidssoekerId()
Expand All @@ -31,6 +34,7 @@ class MergeDetector(
currentPos: Long,
results: Either<Failure, Long>
): Either<Failure, Long> {
logger.info("Processing range:stopAt={}, maxSize={}, currentPos={}, results={}", stopAt, maxSize, currentPos, results)
return when (results) {
is Left -> {
return results
Expand Down

0 comments on commit dbdcdeb

Please sign in to comment.