Skip to content

Commit

Permalink
Sleep after sadd() calls before sscan() calls
Browse files Browse the repository at this point in the history
Due to eventual consistency
  • Loading branch information
jduo committed Jun 28, 2024
1 parent 69744f7 commit af644bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions java/integTest/src/test/java/glide/SharedCommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -7042,6 +7042,12 @@ public void sscan(BaseClient client) {

// Result contains the whole set
assertEquals(charMembers.length, client.sadd(key1, charMembers).get());
// Sleep after sadd() for eventual consistency.
// TODO: Replace sleep with WAIT request to enforce strong consistency.
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
}
result = client.sscan(key1, initialCursor).get();
assertEquals(String.valueOf(initialCursor), result[resultCursorIndex]);
assertEquals(charMembers.length, ((Object[]) result[resultCollectionIndex]).length);
Expand All @@ -7058,6 +7064,12 @@ public void sscan(BaseClient client) {

// Result contains a subset of the key
assertEquals(numberMembers.length, client.sadd(key1, numberMembers).get());
// Sleep after sadd() for eventual consistency.
// TODO: Replace sleep with WAIT request to enforce strong consistency.
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
}
long resultCursor = 0;
final Set<Object> secondResultValues = new HashSet<>();
do {
Expand Down

0 comments on commit af644bb

Please sign in to comment.