From d03505151b65b280bd40539244c4baf8d4f184d1 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Thu, 14 Mar 2024 20:21:32 +0530 Subject: [PATCH] fix: one million user test (#108) --- .../storage/mysql/test/OneMillionUsersTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/test/java/io/supertokens/storage/mysql/test/OneMillionUsersTest.java b/src/test/java/io/supertokens/storage/mysql/test/OneMillionUsersTest.java index 694c74c..1bf503b 100644 --- a/src/test/java/io/supertokens/storage/mysql/test/OneMillionUsersTest.java +++ b/src/test/java/io/supertokens/storage/mysql/test/OneMillionUsersTest.java @@ -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; @@ -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); } @@ -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(); @@ -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(() -> {