mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 18:05:20 +00:00
Prevents infinite loop if offset gets higher than maxSize
This commit is contained in:
parent
5566f047cd
commit
5a2691642b
@ -27,7 +27,8 @@ export function buildOptionsObject(api) {
|
||||
export async function fetchAllAgents(api, maxSize, payload, options) {
|
||||
try {
|
||||
let agents = [];
|
||||
while (agents.length < maxSize) {
|
||||
// Prevents infinite loop if offset gets higher than maxSize
|
||||
while ((agents.length < maxSize) && (payload.offset < maxSize)) {
|
||||
const response = await needle(
|
||||
'get',
|
||||
`${getPath(api)}/agents`,
|
||||
|
Loading…
Reference in New Issue
Block a user