I've more than 1000 test users in both our database and getStream. Now the problem is when clean up test user, I'm able to delete 1000 users using query for our database but for stream i got stumbled.
const users = records.map(u => u.get('data')); // 1000 users in an array
await deleteUsers(users); // deletes in database
await getStreamClient.deleteUsers(users, { // throws error that only upto 100 users are deleted
messages: 'hard',
user: 'hard',
conversations: 'hard'
});
I'm expecting an efficient way to delete the stream users also.
Efficient way would be splitting the users into 100 separate users, any way we can't increase the count of getStream.
const users = records.map(u => u.get('data'));
const streamUsers = [];
const splitCount = Math.round(users.length / 100);
for (let i = 0; i < splitCount; i++) {
streamUsers.push(users.slice(i * 100, 100 + i * 100));
}
const streamDelete = streamUsers.map(users => {
return getStreamClient.deleteUsers(users, {
messages: 'hard',
user: 'hard',
conversations: 'hard'
});
});
await Promise.all(streamDelete);