Skip to content

Commit

Permalink
chore: Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
LichtHund committed Jul 7, 2024
1 parent a777ea4 commit 74c8cc0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/src/main/kotlin/api/ProjectSetup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable
import net.lingala.zip4j.ZipFile
import org.jetbrains.exposed.sql.transactions.transaction
import org.slf4j.LoggerFactory
import java.io.File
import java.io.FileNotFoundException
import java.nio.file.Files
import javax.imageio.ImageIO

private val logger = LoggerFactory.getLogger("project-setup")
private val bannerMaker = BannerMaker()

public suspend fun setupRepository(meili: Meili, projects: File) {

logger.info("Setup projects request received.")

val tempFolder = withContext(Dispatchers.IO) {
Files.createTempDirectory("zip-temp")
}.toFile()
Expand All @@ -45,6 +49,7 @@ public suspend fun setupRepository(meili: Meili, projects: File) {
// Delete downloaded files
projects.delete()

logger.info("Inserting projects...")
transaction {
repo.projects.forEach { project ->

Expand Down Expand Up @@ -106,7 +111,7 @@ public suspend fun setupRepository(meili: Meili, projects: File) {
}
}


logger.info("Preparing search...")
// Search setup
repo.projects.forEach { project ->
project.versions.forEach { version ->
Expand Down Expand Up @@ -135,6 +140,8 @@ public suspend fun setupRepository(meili: Meili, projects: File) {
)
}
}

logger.info("Setup projects done.")
}

private fun descriptionDocument(id: String, description: Page.Description): SearchDocument {
Expand Down

0 comments on commit 74c8cc0

Please sign in to comment.