Skip to content

Commit

Permalink
Fix typo. Scheduled job to 5 min in dev. Removed storing af failed tv…
Browse files Browse the repository at this point in the history
…unget utsending
  • Loading branch information
Vitenok committed Jan 3, 2025
1 parent d53db12 commit 1ff5174
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion nais/job-trigger-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
outbound:
rules:
- application: esyfovarsel
schedule: "*/2 * * * *"
schedule: "*/5 * * * *"
filesFrom:
- secret: esyfovarsel-serviceuser
env:
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/no/nav/syfo/db/UtsendtVarselDAO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fun DatabaseInterface.fetchAlleUferdigstilteAktivitetspliktVarsler(
}
}

fun DatabaseInterface.setUferdigstiltUtsendtVarselToForcedLEtter(eksternRef: String): Int {
fun DatabaseInterface.setUferdigstiltUtsendtVarselToForcedLetter(eksternRef: String): Int {
val updateStatement = """UPDATE UTSENDT_VARSEL
SET is_forced_letter = ?
WHERE EKSTERN_REF = ?
Expand Down
23 changes: 10 additions & 13 deletions src/main/kotlin/no/nav/syfo/service/SenderFacade.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import no.nav.syfo.db.domain.Kanal.DITT_SYKEFRAVAER
import no.nav.syfo.db.domain.PUtsendtVarsel
import no.nav.syfo.db.domain.PUtsendtVarselFeilet
import no.nav.syfo.db.fetchUferdigstilteVarsler
import no.nav.syfo.db.setUferdigstiltUtsendtVarselToForcedLEtter
import no.nav.syfo.db.setUferdigstiltUtsendtVarselToForcedLetter
import no.nav.syfo.db.setUtsendtVarselToFerdigstilt
import no.nav.syfo.db.storeUtsendtVarsel
import no.nav.syfo.db.storeUtsendtVarselFeilet
Expand Down Expand Up @@ -80,7 +80,7 @@ class SenderFacade(
}

fun sendTilBrukernotifikasjoner(
uuid: String,// aktivitetskravUuid
uuid: String, // aktivitetskravUuid
mottakerFnr: String,
content: String,
url: URL? = null,
Expand Down Expand Up @@ -278,20 +278,17 @@ class SenderFacade(
} catch (e: Exception) {
isSendingSucceed = false
log.warn("[FORCED PHYSICAL PRINT]: Error while sending forced brev til forced fysisk print: ${e.message}")
lagreIkkeUtsendtArbeidstakerVarsel(
kanal = BREV,
varselHendelse = varselHendelse,
eksternReferanse = uuid,
feilmelding = e.message,
journalpostId = journalpostId,
brukernotifikasjonerMeldingType = null,
isForcedLetter = true,
)
}
if (isSendingSucceed) {
log.info("[FORCED PHYSICAL PRINT]: sending forced physical letter with journalpostId ${journalpostId} succeded, storing in database")
lagreUtsendtArbeidstakerVarsel(BREV, varselHendelse, uuid, isForcedLetter = true, journalpostId = journalpostId)
database.setUferdigstiltUtsendtVarselToForcedLEtter(eksternRef = uuid)
lagreUtsendtArbeidstakerVarsel(
BREV,
varselHendelse,
uuid,
isForcedLetter = true,
journalpostId = journalpostId
)
database.setUferdigstiltUtsendtVarselToForcedLetter(eksternRef = uuid)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class UtsendtVarselFeiletDAOSpek : DescribeSpec({


// Should not pick original uferdigstilt utsend varsel to notify user by physical letter for the second time
embeddedDatabase.setUferdigstiltUtsendtVarselToForcedLEtter(eksternRef = "123")
embeddedDatabase.setUferdigstiltUtsendtVarselToForcedLetter(eksternRef = "123")
val result2 = embeddedDatabase.fetchAlleUferdigstilteAktivitetspliktVarsler()
result2.size shouldBeEqualTo 2
}
Expand Down

0 comments on commit 1ff5174

Please sign in to comment.