Skip to content

Commit 0db1608

Browse files
bbenner7635Brendan Benner
andauthored
Fix unsatisfied dependency issue in leaderOnlyTokenCrawler (#6230)
Signed-off-by: Brendan Benner <bbenner@amazon.com> Co-authored-by: Brendan Benner <bbenner@amazon.com>
1 parent e53033d commit 0db1608

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

data-prepper-plugins/saas-source-plugins/source-crawler/src/main/java/org/opensearch/dataprepper/plugins/source/source_crawler/base/LeaderOnlyTokenCrawler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class LeaderOnlyTokenCrawler implements Crawler<SaasWorkerProgressState>
3939
public static final String ACKNOWLEDGEMENT_SET_SUCCESS_METRIC_NAME = "acknowledgementSetSuccesses";
4040
public static final String ACKNOWLEDGEMENT_SET_FAILURES_METRIC_NAME = "acknowledgementSetFailures";
4141

42-
private final LeaderOnlyTokenCrawlerClient client;
42+
private final CrawlerClient client;
4343
private final Timer crawlingTimer;
4444
private final PluginMetrics pluginMetrics;
4545
@Setter
@@ -58,7 +58,7 @@ public class LeaderOnlyTokenCrawler implements Crawler<SaasWorkerProgressState>
5858
private Duration noAckTimeout;
5959

6060
public LeaderOnlyTokenCrawler(
61-
LeaderOnlyTokenCrawlerClient client,
61+
CrawlerClient client,
6262
PluginMetrics pluginMetrics) {
6363
this.client = client;
6464
this.pluginMetrics = pluginMetrics;
@@ -82,7 +82,7 @@ public Instant crawl(LeaderPartition leaderPartition,
8282

8383
log.info("Starting leader-only crawl with token: {}", lastToken);
8484

85-
Iterator<ItemInfo> itemIterator = client.listItems(lastToken);
85+
Iterator<ItemInfo> itemIterator = ((LeaderOnlyTokenCrawlerClient) client).listItems(lastToken);
8686

8787
while (itemIterator.hasNext() && !shouldStopCrawl) {
8888
List<ItemInfo> batch = collectBatch(itemIterator);
@@ -161,7 +161,7 @@ private void processBatch(List<ItemInfo> batch,
161161

162162
bufferWriteTimer.record(() -> {
163163
try {
164-
client.writeBatchToBuffer(batch, buffer, acknowledgementSet);
164+
((LeaderOnlyTokenCrawlerClient) client).writeBatchToBuffer(batch, buffer, acknowledgementSet);
165165
acknowledgementSet.complete();
166166
// Check every 15 seconds until either:
167167
// 1. We get an ack (positive/negative)
@@ -191,7 +191,7 @@ private void processBatch(List<ItemInfo> batch,
191191
// Write directly and update checkpoint
192192
bufferWriteTimer.record(() -> {
193193
try {
194-
client.writeBatchToBuffer(batch, buffer, null);
194+
((LeaderOnlyTokenCrawlerClient) client).writeBatchToBuffer(batch, buffer, null);
195195
updateLeaderProgressState(leaderPartition, lastToken, coordinator);
196196
} catch (Exception e) {
197197
log.error("Failed to write batch to buffer", e);

data-prepper-plugins/saas-source-plugins/source-crawler/src/main/java/org/opensearch/dataprepper/plugins/source/source_crawler/base/LeaderOnlyTokenCrawlerClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* This interface adds additional method for direct buffer writing,
1515
* optimized for single-leader processing without worker partitions.
1616
*/
17-
public interface LeaderOnlyTokenCrawlerClient extends TokenCrawlerClient<PaginationCrawlerWorkerProgressState> {
17+
public interface LeaderOnlyTokenCrawlerClient<T extends SaasWorkerProgressState> extends TokenCrawlerClient<PaginationCrawlerWorkerProgressState> {
1818
/**
1919
* Writes a batch of items directly to the buffer.
2020
*

0 commit comments

Comments
 (0)