Dear all,
asking for small help to deal with concurrency in Groovy.
I’m executing the following function:
def sendFiles(host, repo, dist, files) {
def threads = []
files.each { file->
def th = Thread.start {
pushFileViaCurlTest(repo, dist, file)
} // end th
threads << th
println "putting thread: ${th} in threads list"
}
// wait all threads
threads.each { it.join() }
}
def pushFileViaCurlTest(repo, dist, file) {
def host = 'https://example.com/'
def curl_status = sh(
script: "curl -i --fail -XPOST -F 'filename=@${file}' '${host}/?repo=${repo}&dis=${dist}' ",
returnStdout: true,
)
print curl_status
}
But I don’t see any logs in my web server…? (web server works fine).
Even I change shell command to println
- I don’t see any output
it looks like sh
hasn’t been executed, could you please tell me how to debug / fix it?
Appreciate any suggestion and documentation to read.
Thank you,
Pasha