Skip to content

Commit

Permalink
Fixing package upload from new UI (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
philboeselager committed Oct 28, 2020
1 parent f6daf97 commit d7c4922
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion grails-app/services/ygor/EnrichmentService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class EnrichmentService{
}
// Main processing finished here.
// Upload is following - send package with integrated title data
String uri = Holders.config.gokbApi.xrPackageUri
String uri = Holders.config.gokbApi.xrPackageUri.concat("?async=true")
SendPackageThreadGokb sendPackageThreadGokb
if (!StringUtils.isEmpty(enrichment.dataContainer.pkgHeader.token)){
// send with token-based authentication
Expand All @@ -315,6 +315,8 @@ class EnrichmentService{
uploadJob.start()
while (uploadJob.status in [UploadThreadGokb.Status.PREPARATION, UploadThreadGokb.Status.STARTED]){
Thread.sleep(1000)
uploadJob.updateCount()
uploadJob.refreshStatus()
}
return uploadJob
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class SendPackageThreadGokb extends UploadThreadGokb{
else{
result << GokbExporter.sendText(uri, json.getText(), user, password, locale)
}
gokbJobId = result[0].get("info")?.get("job_id")?.toString()
}


Expand Down Expand Up @@ -125,7 +126,7 @@ class SendPackageThreadGokb extends UploadThreadGokb{

private String getJobId(){
if (gokbJobId == null && result != null && result.size() > 0 && result[0].get("info") != null){
gokbJobId = result[0].get("info")?.get("job_id")
gokbJobId = result[0].get("info")?.get("job_id").toString()
}
return gokbJobId
}
Expand Down
6 changes: 3 additions & 3 deletions src/groovy/de/hbznrw/ygor/processing/UploadThreadGokb.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ abstract class UploadThreadGokb extends Thread{

void refreshStatus(){
if (status == Status.STARTED){
if (count >= total){
status = Status.FINISHED_UNDEFINED
}
String responseStatus = getGokbResponseValue("responseStatus", true)
if (responseStatus == null && status == Status.STARTED){
if (result.size() > 0 && result[0].get("error") != null){
Expand All @@ -40,6 +37,9 @@ abstract class UploadThreadGokb extends Thread{
status = Status.ERROR
return
}
if (count >= total){
status = Status.SUCCESS
}
}
}

Expand Down

0 comments on commit d7c4922

Please sign in to comment.