Lucas_Werkmeister_WMDE added a comment.

Looking a bit more closely at the code, I suspect I’ve slightly misdiagnosed the problem. Specifically, consider ContinueIterator::next, near the end of MWApiServiceCall.java:

@Override
public IBindingSet next() {
    if (recordsCount >= maxContinue) {
        close();
    }
    if (closed || lastResult == null) {
        return null;
    }
    if (lastResult.getResultIterator().hasNext()) {
        recordsCount++;
        return lastResult.getResultIterator().next();
    }
    // If we can continue, do the continue                                                                                                                                            
    if (allowContinue && lastResult.getContinue() != null) {
        lastResult = doSearchRequest(recordsCount);
    }
    if (closed || lastResult == null) {
        return null;
    }
    if (lastResult.getResultIterator().hasNext()) {
        recordsCount++;
        return lastResult.getResultIterator().next();
    }
    return null;
}

This looks like it should handle a single empty page correctly – but I think it might get tripped up if there are multiple consecutive empty pages. The duplicated code in there before and after the continue handling smells of something that should be a loop instead.


TASK DETAIL
https://phabricator.wikimedia.org/T209034

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Aklapper, Smalyshev, Lucas_Werkmeister_WMDE, Nikki, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, EBjune, merbst, LawExplorer, Jonas, Xmlizer, jkroll, Wikidata-bugs, Jdouglas, aude, Tobias1984, Manybubbles, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to