Skip to content

Commit

Permalink
fjern rebuild av hard deletes tilstand
Browse files Browse the repository at this point in the history
  • Loading branch information
kenglxn committed Jan 7, 2025
1 parent 8466553 commit 1dd6661
Showing 1 changed file with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import no.nav.arbeidsgiver.notifikasjon.hendelse.HendelseModel
import no.nav.arbeidsgiver.notifikasjon.infrastruktur.Database
import no.nav.arbeidsgiver.notifikasjon.infrastruktur.Database.Companion.openDatabaseAsync
import no.nav.arbeidsgiver.notifikasjon.infrastruktur.http.launchHttpServer
Expand All @@ -25,13 +24,6 @@ object SkedulertHardDelete {
)
}

private val rebuildHardDeleted by lazy {
HendelsesstrømKafkaImpl(
topic = NOTIFIKASJON_TOPIC,
groupId = "skedulert-harddelete-model-rebuild-07.01.2025",
)
}

fun main(httpPort: Int = 8080) {
runBlocking(Dispatchers.Default) {
val database = openDatabaseAsync(databaseConfig)
Expand All @@ -45,31 +37,6 @@ object SkedulertHardDelete {
repo.oppdaterModellEtterHendelse(hendelse, metadata.timestamp)
}
}
launch {
val repo = repoAsync.await()
rebuildHardDeleted.forEach { hendelse, metadata ->
when (hendelse) {
is HendelseModel.SoftDelete,
is HendelseModel.HardDelete -> {
repo.delete(
aggregateId = hendelse.aggregateId,
merkelapp = when (hendelse) {
is HendelseModel.HardDelete -> hendelse.merkelapp
is HendelseModel.SoftDelete -> hendelse.merkelapp
else -> throw IllegalStateException("unexpected event type")
},
grupperingsid = when (hendelse) {
is HendelseModel.HardDelete -> hendelse.grupperingsid
is HendelseModel.SoftDelete -> null
else -> throw IllegalStateException("unexpected event type")
}
)
}

else -> Unit
}
}
}

val service = async {
SkedulertHardDeleteService(repoAsync.await(), lagKafkaHendelseProdusent(topic = NOTIFIKASJON_TOPIC))
Expand Down

0 comments on commit 1dd6661

Please sign in to comment.