Skip to content

Commit

Permalink
Legger tilbake suspend på finnSaksbehandlerMedEpost for å slippe å må…
Browse files Browse the repository at this point in the history
…tte sende overføre tokenet til ny context (og slippe å sende tokenet nedover fra alle steder metoden kalles) (#1847)
  • Loading branch information
baskevold authored Jan 16, 2024
1 parent 75b825d commit 80ed904
Showing 1 changed file with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,31 +271,24 @@ class SaksbehandlerRepository(
}
}

fun finnSaksbehandlerMedEpost(epost: String): Saksbehandler? {
return using(sessionOf(dataSource)) { session ->
session.transaction {
finnSaksbehandlerMedEpost(epost, it)
}
}
}

fun finnSaksbehandlerMedEpost(epost: String, tx: TransactionalSession): Saksbehandler? {
val skjermet = runBlocking {
pepClient.harTilgangTilKode6()
}
suspend fun finnSaksbehandlerMedEpost(epost: String): Saksbehandler? {
val skjermet = pepClient.harTilgangTilKode6()

Databasekall.map.computeIfAbsent(object {}.javaClass.name + object {}.javaClass.enclosingMethod.name) { LongAdder() }
.increment()

val saksbehandler = tx.run(
queryOf(
"select * from saksbehandler where lower(epost) = lower(:epost) and skjermet = :skjermet",
mapOf("epost" to epost, "skjermet" to skjermet)
)
.map { row ->
mapSaksbehandler(row)
}.asSingle
)
val saksbehandler = using(sessionOf(dataSource)) { session ->
session.transaction { tx ->
tx.run(
queryOf(
"select * from saksbehandler where lower(epost) = lower(:epost) and skjermet = :skjermet",
mapOf("epost" to epost, "skjermet" to skjermet)
).map { row ->
mapSaksbehandler(row)
}.asSingle
)
}
}
return saksbehandler
}

Expand Down

0 comments on commit 80ed904

Please sign in to comment.