Skip to content

Commit

Permalink
resolved comment
Browse files Browse the repository at this point in the history
  • Loading branch information
heesung-sn committed Sep 18, 2024
1 parent 04158a7 commit 7faccbb
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
@Slf4j
public class ServiceUnitStateTableViewSyncer implements Closeable {
private static final int MAX_CONCURRENT_SYNC_COUNT = 100;
private static final int MAX_SYNC_WAIT_TIME_IN_SECS = 300;
private volatile ServiceUnitStateTableView systemTopicTableView;
private volatile ServiceUnitStateTableView metadataStoreTableView;
private volatile boolean isActive = false;
Expand Down Expand Up @@ -116,14 +117,14 @@ public void start(PulsarService pulsar)
futures.clear();

int size = merged.size();
int syncTimeout = opTimeout * size;
while (metadataStoreTableView.entrySet().size() != size || systemTopicTableView.entrySet().size() != size) {
if (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - started) > syncTimeout) {
if (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - started)
> MAX_SYNC_WAIT_TIME_IN_SECS) {
throw new TimeoutException(
"Failed to sync tableviews. MetadataStoreTableView.size: "
+ metadataStoreTableView.entrySet().size()
+ ", SystemTopicTableView.size: " + systemTopicTableView.entrySet().size() + " in "
+ syncTimeout + " secs");
+ MAX_SYNC_WAIT_TIME_IN_SECS + " secs");
}
Thread.sleep(100);
}
Expand All @@ -144,7 +145,7 @@ private CompletableFuture<Void> syncToSystemTopic(String key, ServiceUnitStateDa
return systemTopicTableView.put(key, data);
}

private CompletableFuture<Void> syncToMetadataStore(String key, ServiceUnitStateData data) {
private CompletableFuture<Void> syncToMetadataStore(String key, ServiceUnitStateData data) {
return metadataStoreTableView.put(key, data);
}

Expand Down

0 comments on commit 7faccbb

Please sign in to comment.