Commit eab9b663 authored by Matija Obreza's avatar Matija Obreza
Browse files

AccessionProcessor: Increased timeouts and randomized Thread.sleep

parent 1c6092dc
...@@ -313,7 +313,7 @@ public class AccessionServiceImpl implements AccessionService { ...@@ -313,7 +313,7 @@ public class AccessionServiceImpl implements AccessionService {
} }
@Override @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) { public List<Accession> processAccessions(List<Long> accessionIds, IAccessionAction action) {
List<Accession> accessions = accessionRepository.findAll(accessionIds); List<Accession> accessions = accessionRepository.findAll(accessionIds);
LOG.debug("Processing {} accessions of {} IDs provided", accessions.size(), accessionIds.size()); LOG.debug("Processing {} accessions of {} IDs provided", accessions.size(), accessionIds.size());
...@@ -328,7 +328,7 @@ public class AccessionServiceImpl implements AccessionService { ...@@ -328,7 +328,7 @@ public class AccessionServiceImpl implements AccessionService {
} }
@Override @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) { public List<Accession> processAccessions(List<Long> accessionIds, IAccessionBatchAction action) {
List<Accession> accessions = accessionRepository.findAll(accessionIds); List<Accession> accessions = accessionRepository.findAll(accessionIds);
LOG.debug("Processing {} accessions of {} IDs provided", accessions.size(), accessionIds.size()); LOG.debug("Processing {} accessions of {} IDs provided", accessions.size(), accessionIds.size());
......
...@@ -20,6 +20,7 @@ import java.util.List; ...@@ -20,6 +20,7 @@ import java.util.List;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.StopWatch; import org.apache.commons.lang3.time.StopWatch;
import org.genesys2.server.model.genesys.Accession; import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.QAccession; import org.genesys2.server.model.genesys.QAccession;
...@@ -217,7 +218,7 @@ public class AccessionProcessor { ...@@ -217,7 +218,7 @@ public class AccessionProcessor {
} }
LOG.warn("Error executing action on batch: {}. Retrying.", e.getMessage()); LOG.warn("Error executing action on batch: {}. Retrying.", e.getMessage());
try { try {
Thread.sleep(250); Thread.sleep(RandomUtils.nextInt(10, 1000));
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
} }
} }
......
...@@ -32,6 +32,7 @@ import java.util.Set; ...@@ -32,6 +32,7 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ClientProtocolException;
...@@ -191,7 +192,7 @@ public class WorldClimUpdater implements InitializingBean { ...@@ -191,7 +192,7 @@ public class WorldClimUpdater implements InitializingBean {
} }
LOG.warn("Problem updating variable {}. {}. Retrying.", variableName, e.getMessage()); LOG.warn("Problem updating variable {}. {}. Retrying.", variableName, e.getMessage());
try { try {
Thread.sleep(250); Thread.sleep(RandomUtils.nextInt(10, 1000));
} catch (InterruptedException e1) { } 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