Skip to content

Commit

Permalink
fix offset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chenby committed Feb 21, 2019
1 parent 9045113 commit 7b16eb4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/test/java/com/moilioncircle/redis/replicator/PsyncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,21 @@ public void onEvent(Replicator replicator, Event event) {
}
if (event instanceof SetCommand && Strings.toString(((SetCommand) event).getKey()).startsWith("psync")) {
acc.incrementAndGet();
if (acc.get() == 200) {
if (acc.get() == 500) {
//close current process port;
//that will auto trigger psync command
close(replicator);
}
if (acc.get() == 980) {

if (acc.get() == 1010) {
//close current process port;
//that will auto trigger psync command
close(replicator);
}
if (acc.get() == 1480) {
configuration.setVerbose(true);
}
if (acc.get() == 1000) {
if (acc.get() == 1500) {
try {
replicator.close();
} catch (IOException e) {
Expand All @@ -96,7 +102,7 @@ public void onEvent(Replicator replicator, Event event) {
}
});
replicator.open();
assertEquals(1000, acc.get());
assertEquals(1500, acc.get());
}

private static void close(Replicator replicator) {
Expand All @@ -120,7 +126,7 @@ private static class JRun implements Runnable {
public void run() {
Jedis jedis = new Jedis("127.0.0.1", 6380);
jedis.auth("test");
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < 1500; i++) {
jedis.set("psync " + i, "psync" + i);
try {
Thread.sleep(20);
Expand Down

0 comments on commit 7b16eb4

Please sign in to comment.