Skip to content

Commit

Permalink
fix: one million user test (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc authored Mar 14, 2024
1 parent c410d3e commit d035051
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ private void createSessions(Main main) throws Exception {
System.out.println("Creating sessions...");

ExecutorService es = Executors.newFixedThreadPool(NUM_THREADS);
AtomicLong usersUpdated = new AtomicLong(0);

for (String userId : allUserIds) {
String finalUserId = userId;
Expand All @@ -376,6 +377,11 @@ private void createSessions(Main main) throws Exception {
}
}

long count = usersUpdated.incrementAndGet();
if (count % 10000 == 9999) {
System.out.println("Created " + (count) + " sessions");
}

} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -845,16 +851,14 @@ private void measureOperations(Main main) throws Exception {
long count = 0;
UserPaginationContainer users = AuthRecipe.getUsers(main, 500, "ASC", null, null, null);
while (true) {
for (AuthRecipeUserInfo user : users.users) {
count += user.loginMethods.length;
}
count += users.users.length;
if (users.nextPaginationToken == null) {
break;
}
users = AuthRecipe.getUsers(main, 500, "ASC", users.nextPaginationToken, null, null);
if (count >= 500) {
if (count >= 2000) {
break;
}
users = AuthRecipe.getUsers(main, 500, "ASC", users.nextPaginationToken, null, null);
}
} catch (Exception e) {
errorCount.incrementAndGet();
Expand All @@ -863,7 +867,7 @@ private void measureOperations(Main main) throws Exception {
return null;
});
System.out.println("User pagination " + time);
assert time < 2000;
assert time < 8000;
}
{ // Measure update user metadata
long time = measureTime(() -> {
Expand Down

0 comments on commit d035051

Please sign in to comment.