Compute delay from request issue, not response return. Fixes #721

This commit is contained in:
Tom Morris 2013-05-26 10:13:16 -04:00
parent 4a5d3d4662
commit 000c0a38a8

View File

@ -222,6 +222,7 @@ public class ColumnAdditionByFetchingURLsOperation extends EngineDependentOperat
List<CellAtRow> responseBodies = new ArrayList<CellAtRow>(urls.size());
for (int i = 0; i < urls.size(); i++) {
CellAtRow urlData = urls.get(i);
long start = System.currentTimeMillis();
CellAtRow cellAtRow = fetch(urlData);
if (cellAtRow != null) {
responseBodies.add(cellAtRow);
@ -229,7 +230,10 @@ public class ColumnAdditionByFetchingURLsOperation extends EngineDependentOperat
_progress = i * 100 / urls.size();
try {
Thread.sleep(_delay);
long delay = _delay - (System.currentTimeMillis() - start);
if (delay > 0) {
Thread.sleep(delay);
}
} catch (InterruptedException e) {
if (_canceled) {
break;