Commit eab9b663 authored by Matija Obreza's avatar Matija Obreza

AccessionProcessor: Increased timeouts and randomized Thread.sleep

parent 1c6092dc
......@@ -313,7 +313,7 @@ public class AccessionServiceImpl implements AccessionService {
}
@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, timeout = 30)
public List<Accession> processAccessions(List<Long> accessionIds, IAccessionAction action) {
List<Accession> accessions = accessionRepository.findAll(accessionIds);
LOG.debug("Processing {} accessions of {} IDs provided", accessions.size(), accessionIds.size());
......@@ -328,7 +328,7 @@ public class AccessionServiceImpl implements AccessionService {
}
@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, timeout = 10)
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, timeout = 30)
public List<Accession> processAccessions(List<Long> accessionIds, IAccessionBatchAction action) {
List<Accession> accessions = accessionRepository.findAll(accessionIds);
LOG.debug("Processing {} accessions of {} IDs provided", accessions.size(), accessionIds.size());
......
......@@ -20,6 +20,7 @@ import java.util.List;
import javax.persistence.EntityManager;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.QAccession;
......@@ -217,7 +218,7 @@ public class AccessionProcessor {
}
LOG.warn("Error executing action on batch: {}. Retrying.", e.getMessage());
try {
Thread.sleep(250);
Thread.sleep(RandomUtils.nextInt(10, 1000));
} catch (InterruptedException e1) {
}
}
......
......@@ -32,6 +32,7 @@ import java.util.Set;
import java.util.UUID;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
......@@ -191,7 +192,7 @@ public class WorldClimUpdater implements InitializingBean {
}
LOG.warn("Problem updating variable {}. {}. Retrying.", variableName, e.getMessage());
try {
Thread.sleep(250);
Thread.sleep(RandomUtils.nextInt(10, 1000));
} catch (InterruptedException e1) {
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment