Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Baoyi Chen committed Dec 9, 2023
1 parent 3b9e9a8 commit e29de44
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,22 @@ public void psync() throws IOException {
@Override
public void onEvent(Replicator replicator, Event event) {
if (event instanceof PreRdbSyncEvent) {
r.getLogger().info("id:{}, offset:{}", configuration.getReplId(), configuration.getReplOffset());
acc1.incrementAndGet();
}

if (event instanceof KeyValuePair) {
if (flag1.compareAndSet(false, true)) {
// will trigger full sync at this time
r.getLogger().info("psync close 1");
close(replicator);
}
}

if (event instanceof PostRdbSyncEvent) {
if (flag.compareAndSet(false, true)) {
// will trigger full sync at this time
r.getLogger().info("psync close 2");
close(replicator);
Thread thread = new Thread(new JRun());
thread.setDaemon(true);
Expand All @@ -108,13 +111,15 @@ public void onEvent(Replicator replicator, Event event) {
if (acc.get() == 500) {
//close current process port;
//that will auto trigger psync command
r.getLogger().info("psync close 3");
r.getLogger().info("id:{}, offset:{}", configuration.getReplId(), configuration.getReplOffset());
close(replicator);
}

if (acc.get() == 1010) {
//close current process port;
//that will auto trigger psync command
r.getLogger().info("psync close 4");
r.getLogger().info("id:{}, offset:{}", configuration.getReplId(), configuration.getReplOffset());
close(replicator);
}
Expand Down

0 comments on commit e29de44

Please sign in to comment.