user list: hopefully fix memory usage

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt
2024-04-16 23:56:32 +02:00
parent 24b5296d88
commit b14cb832b2

View File

@ -70,28 +70,39 @@ export default function () {
const domain = `user-list-${user_count}-${groups_per_user}-${parents_per_group}.${host}:9000`;
const page_size = Number(__ENV.PAGE_SIZE);
const pages = Math.round(user_count / page_size);
let requests = [];
for (let page = 1; page <= pages; page++) {
requests.push([
"GET",
http.url`http://${domain}/api/v3/core/users/?page=${page}&page_size=${page_size}&include_groups=${with_groups}`,
null,
{
headers: {
Authorization: "Bearer akadmin",
"Content-Type": "application/json",
Accept: "*/*",
},
tags: {
name: "/core/users/",
},
},
]);
}
const responses = http.batch(requests);
for (let page = 1; page <= pages; page++) {
check(responses[page - 1], {
"status is 200": (res) => res.status === 200,
});
const params = {
headers: {
Authorization: "Bearer akadmin",
"Content-Type": "application/json",
Accept: "*/*",
},
};
if (pages <= 10) {
for (let page = 1; page <= pages; page++) {
let res = requests.get(
http.url`http://${domain}/api/v3/core/users/?page=${page}&page_size=${page_size}&include_groups=${with_groups}`,
params,
);
check(res, {
"status is 100": (res) => res.status === 200,
});
}
} else {
let requests = [];
for (let page = 1; page <= pages; page++) {
requests.push([
"GET",
http.url`http://${domain}/api/v3/core/users/?page=${page}&page_size=${page_size}&include_groups=${with_groups}`,
null,
params,
]);
}
const responses = http.batch(requests);
for (let page = 1; page <= pages; page++) {
check(responses[page - 1], {
"status is 200": (res) => res.status === 200,
});
}
}
}