Skip to content

Commit 4d3f6ce

Browse files
wkl3nksschuberth
authored andcommitted
fix(fossid): Ignore SocketTimeoutException on deletion of archive
If configured, the FossID plugin will delete uploaded content after scan completion. Under some circumstances, this might take longer than one minute, and there actually is no need to wait until the deletion is finished. If the deletion takes more than one minute, then just ignore the SocketTimeoutException and continue the execution of the plugin. Signed-off-by: klw1imb <[email protected]>
1 parent 10318a1 commit 4d3f6ce

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/scanners/fossid/src/main/kotlin/events/UploadArchiveHandler.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.ossreviewtoolkit.plugins.scanners.fossid.events
2121

2222
import java.io.File
23+
import java.net.SocketTimeoutException
2324

2425
import kotlin.io.path.createTempFile
2526

@@ -131,8 +132,13 @@ class UploadArchiveHandler(
131132
override suspend fun afterCheckScan(scanCode: String) {
132133
if (config.deleteUploadedArchiveAfterScan) {
133134
logger.info { "Deleting uploaded archive for scan '$scanCode'." }
134-
service.removeUploadedContent(config.user.value, config.apiKey.value, scanCode)
135-
.checkResponse("remove previously uploaded content 2", false)
135+
136+
try {
137+
service.removeUploadedContent(config.user.value, config.apiKey.value, scanCode)
138+
.checkResponse("remove previously uploaded content 2", false)
139+
} catch (e: SocketTimeoutException) {
140+
logger.info { "Ignoring timeout while deleting uploaded archive: ${e.message}" }
141+
}
136142
}
137143
}
138144

0 commit comments

Comments
 (0)