Skip to content

Commit

Permalink
remove service that updates statuses (#143)
Browse files Browse the repository at this point in the history
* remove service that updates statuses

* remove more stuff
  • Loading branch information
andreasDev committed Jul 24, 2023
1 parent 626ae02 commit 82027c1
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 367 deletions.
1 change: 0 additions & 1 deletion naiserator-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
labels:
team: teamsykmelding
spec:
leaderElection: true
gcp:
sqlInstances:
- name: syfosmmanuell-backend-instance
Expand Down
1 change: 0 additions & 1 deletion naiserator-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
labels:
team: teamsykmelding
spec:
leaderElection: true
gcp:
sqlInstances:
- name: syfosmmanuell-backend-instance
Expand Down
14 changes: 2 additions & 12 deletions src/main/kotlin/no/nav/syfo/Bootstrap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ import no.nav.syfo.clients.HttpClients
import no.nav.syfo.clients.KafkaConsumers
import no.nav.syfo.clients.KafkaProducers
import no.nav.syfo.db.Database
import no.nav.syfo.elector.LeaderElector
import no.nav.syfo.elector.LeadershipHandling
import no.nav.syfo.oppgave.kafka.OppgaveHendelseConsumer
import no.nav.syfo.oppgave.service.OppgaveService
import no.nav.syfo.oppgave.service.UpdateStatusService
import no.nav.syfo.persistering.MottattSykmeldingService
import no.nav.syfo.service.ManuellOppgaveService
import no.nav.syfo.util.TrackableException
Expand Down Expand Up @@ -109,15 +106,8 @@ fun main() {
createListener(applicationState) {
oppgaveHendelseConsumer.start()
}
val leaderElectorService = LeadershipHandling(
updateService = UpdateStatusService(
database = database,
oppgaveClient = httpClients.oppgaveClient,
),
LeaderElector(httpClient = httpClients.httpClient, env.electorPath),
)
leaderElectorService.start()
ApplicationServer(applicationEngine, applicationState, leaderElectorService).start()

ApplicationServer(applicationEngine, applicationState).start()
}

@DelicateCoroutinesApi
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/no/nav/syfo/Environment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ data class Environment(
val dbName: String = getEnvVar("DB_DATABASE"),
val cluster: String = getEnvVar("NAIS_CLUSTER_NAME"),
val oppgaveHendelseTopic: String = getEnvVar("OPPGAVE_HENDELSE_TOPIC"),
val electorPath: String = getEnvVar("ELECTOR_PATH"),
)

fun getEnvVar(varName: String, defaultValue: String? = null) =
Expand Down
3 changes: 0 additions & 3 deletions src/main/kotlin/no/nav/syfo/application/ApplicationServer.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package no.nav.syfo.application

import io.ktor.server.engine.ApplicationEngine
import no.nav.syfo.elector.LeadershipHandling
import java.util.concurrent.TimeUnit

class ApplicationServer(
private val applicationServer: ApplicationEngine,
private val applicationState: ApplicationState,
private val leaderElectorService: LeadershipHandling,
) {

init {
Runtime.getRuntime().addShutdownHook(
Thread {
this.applicationState.ready = false
leaderElectorService.stop()
this.applicationServer.stop(TimeUnit.SECONDS.toMillis(10), TimeUnit.SECONDS.toMillis(10))
},
)
Expand Down
35 changes: 0 additions & 35 deletions src/main/kotlin/no/nav/syfo/elector/LeaderElector.kt

This file was deleted.

78 changes: 0 additions & 78 deletions src/main/kotlin/no/nav/syfo/elector/LeadershipHandling.kt

This file was deleted.

92 changes: 0 additions & 92 deletions src/main/kotlin/no/nav/syfo/oppgave/service/UpdateStatusService.kt

This file was deleted.

1 change: 0 additions & 1 deletion src/test/kotlin/no/nav/syfo/api/AuthenticateTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class AuthenticateTest : FunSpec({
dbPort = "",
cluster = "dev-gcp",
oppgaveHendelseTopic = "oppgavehendlese",
electorPath = "Electorpath",
)
with(TestApplicationEngine()) {
start()
Expand Down
49 changes: 0 additions & 49 deletions src/test/kotlin/no/nav/syfo/elector/LeadershipHandlingTest.kt

This file was deleted.

This file was deleted.

Loading

0 comments on commit 82027c1

Please sign in to comment.