Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import io.socket.client.Socket
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import kotlinx.serialization.decodeFromByteArray
Expand Down Expand Up @@ -92,19 +93,21 @@ class ClusterService(

val sema = Semaphore(syncConfig.concurrency)

missingFiles.forEach { file ->
sema.withPermit {
async {
try {
downloadFile(file)
logger.debug { "Downloaded: ${file.path}" }
} catch (e: Exception) {
logger.error(e) { "Failed to download ${file.path}" }
throw e
}
}
}
}
val jobs = missingFiles.map { file ->
async {
sema.withPermit {
try {
downloadFile(file)
logger.debug { "Downloaded: ${file.path}" }
} catch (e: Exception) {
logger.error(e) { "Failed to download ${file.path}" }
throw e
}
}
}
}

jobs.awaitAll()
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: the new code uses tabs while the rest of the file uses spaces (4 spaces per indentation level). Please convert the tabs to spaces to match the existing code style.

Suggested change
val jobs = missingFiles.map { file ->
async {
sema.withPermit {
try {
downloadFile(file)
logger.debug { "Downloaded: ${file.path}" }
} catch (e: Exception) {
logger.error(e) { "Failed to download ${file.path}" }
throw e
}
}
}
}
jobs.awaitAll()
val jobs = missingFiles.map { file ->
async {
sema.withPermit {
try {
downloadFile(file)
logger.debug { "Downloaded: ${file.path}" }
} catch (e: Exception) {
logger.error(e) { "Failed to download ${file.path}" }
throw e
}
}
}
}
jobs.awaitAll()

Copilot uses AI. Check for mistakes.

logger.info { "Sync completed: ${missingFiles.size} files" }
}
Expand Down