From 000c0a38a8965a20fbd3a44b6424526609bb64ea Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sun, 26 May 2013 10:13:16 -0400 Subject: [PATCH] Compute delay from request issue, not response return. Fixes #721 --- .../column/ColumnAdditionByFetchingURLsOperation.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java b/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java index e5dd0ca8a..22b715bf8 100644 --- a/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java +++ b/main/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperation.java @@ -222,6 +222,7 @@ public class ColumnAdditionByFetchingURLsOperation extends EngineDependentOperat List responseBodies = new ArrayList(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;