Skip to content

Commit 2fafb86

Browse files
authored
chore(server): simplify refresh route logic (#1906)
1 parent df075a2 commit 2fafb86

File tree

1 file changed

+3
-6
lines changed
  • jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver

1 file changed

+3
-6
lines changed

jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutes.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,10 @@ private suspend fun ApplicationCall.toBindingArtifacts(refresh: Boolean): Map<St
102102
val actionCoords = parameters.extractActionCoords(extractVersion = true)
103103

104104
logger.info { "➡️ Requesting ${actionCoords.prettyPrint}" }
105-
return if (refresh) {
106-
actionCoords.buildVersionArtifacts().also {
107-
bindingsCache.put(actionCoords, runCatching { it!! })
108-
}
109-
} else {
110-
bindingsCache.get(actionCoords) { runCatching { actionCoords.buildVersionArtifacts()!! } }.getOrNull()
105+
if (refresh) {
106+
bindingsCache.invalidate(actionCoords)
111107
}
108+
return bindingsCache.get(actionCoords) { runCatching { actionCoords.buildVersionArtifacts()!! } }.getOrNull()
112109
}
113110

114111
private fun incrementArtifactCounter(

0 commit comments

Comments
 (0)