DBZ-1889 Prevent Connect throttling while connection is down

This commit is contained in:
Jiri Pechanec 2020-03-23 12:40:37 +01:00 committed by Gunnar Morling
parent 224f97e380
commit d2bdcd1ab3

View File

@ -34,6 +34,8 @@
*/
public abstract class BaseSourceTask extends SourceTask {
private static final int PAUSE_WHEN_NOT_STARTED = 2_000;
private static final Logger LOGGER = LoggerFactory.getLogger(BaseSourceTask.class);
protected static enum State {
@ -117,6 +119,10 @@ public final List<SourceRecord> poll() throws InterruptedException {
// in backoff period after a retriable exception
if (!started) {
// WorkerSourceTask calls us immediately after we return the empty list.
// This turns into a throttling so we need to make a pause before we return
// the control back.
Thread.sleep(PAUSE_WHEN_NOT_STARTED);
return Collections.emptyList();
}