-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Samle logikk for utsatt oppgave i service #374
base: master
Are you sure you want to change the base?
Conversation
private val logger = this.logger() | ||
|
||
fun opprettOppgaveIGosys( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Denne er bare flyttet på, men noen småforbedringer som ikke endrer funksjonalitet.
if (oppgave.timeout == null) { | ||
metrikk.tellUtsattOppgave_UtenDato() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sletter denne, da den aldri til oppstå. timeout
er ikke nullable. Fjerner også tellUtsattOppgave_UtenDato
-metrikken, da den kun ble brukt her.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout ER jo nullable:
class OppgaveOppdatering(
val id: UUID,
val handling: Handling,
val timeout: LocalDateTime?,
val oppdateringstype: OppdateringstypeDTO
)
if (oppgave.tilstand == Tilstand.Utsatt && oppdatering.handling == no.nav.syfo.utsattoppgave.Handling.Utsett) { | ||
if (oppgave.timeout == null) { | ||
metrikk.tellUtsattOppgave_UtenDato() | ||
return when { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Her bytter jeg bare if
-ene med en when
, og bruker piping der det føles naturlig.
oppgave | ||
.apply { | ||
oppdatert = LocalDateTime.now() | ||
} | ||
.copy( | ||
tilstand = Tilstand.Forkastet, | ||
speil = gjelderSpeil, | ||
) | ||
.lagre() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeg forstår ikke helt hvorfor oppgave
blir muterer oppdatert
-feltet, for så å bruke den ikke-muterende copy
-funksjonen 🤷
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout er satt som optional. Kan ikke godkjenne denne da...
if (oppgave.timeout == null) { | ||
metrikk.tellUtsattOppgave_UtenDato() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout ER jo nullable:
class OppgaveOppdatering(
val id: UUID,
val handling: Handling,
val timeout: LocalDateTime?,
val oppdateringstype: OppdateringstypeDTO
)
No description provided.