Fix useless waiting time before creating items when uploading to Wikibase. (#4227)
Checks that there is at least one item to fetch before attempting to fetch anything. Closes #4226.
This commit is contained in:
parent
235b5957e2
commit
6372f2d382
@ -223,7 +223,7 @@ public class EditBatchProcessor {
|
|||||||
int backoff = 2;
|
int backoff = 2;
|
||||||
int sleepTime = 5000;
|
int sleepTime = 5000;
|
||||||
// TODO: remove currentDocs.isEmpty() once https://github.com/Wikidata/Wikidata-Toolkit/issues/402 is solved
|
// TODO: remove currentDocs.isEmpty() once https://github.com/Wikidata/Wikidata-Toolkit/issues/402 is solved
|
||||||
while ((currentDocs == null || currentDocs.isEmpty()) && retries > 0) {
|
while ((currentDocs == null || currentDocs.isEmpty()) && retries > 0 && !qidsToFetch.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
currentDocs = fetcher.getEntityDocuments(qidsToFetch);
|
currentDocs = fetcher.getEntityDocuments(qidsToFetch);
|
||||||
} catch (MediaWikiApiErrorException e) {
|
} catch (MediaWikiApiErrorException e) {
|
||||||
@ -234,7 +234,7 @@ public class EditBatchProcessor {
|
|||||||
}
|
}
|
||||||
retries--;
|
retries--;
|
||||||
sleepTime *= backoff;
|
sleepTime *= backoff;
|
||||||
if ((currentDocs == null || currentDocs.isEmpty()) && retries > 0) {
|
if ((currentDocs == null || currentDocs.isEmpty()) && retries > 0 && !qidsToFetch.isEmpty()) {
|
||||||
logger.warn("Retrying in " + sleepTime + " ms");
|
logger.warn("Retrying in " + sleepTime + " ms");
|
||||||
Thread.sleep(sleepTime);
|
Thread.sleep(sleepTime);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user