mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Adds an upper limit on recursive calls set statically in the method at 5.
This commit is contained in:
parent
a71a9057a2
commit
81822dfd1c
@ -21,8 +21,11 @@ class Credentials extends Base {
|
||||
}
|
||||
|
||||
readInputSources(id) {
|
||||
const maxRequests = 5;
|
||||
let requestCounter = 0;
|
||||
const fetchInputSources = async (pageNo = 1, inputSources = []) => {
|
||||
try {
|
||||
requestCounter++;
|
||||
const { data } = await this.http.get(
|
||||
`${this.baseUrl}${id}/input_sources/`,
|
||||
{
|
||||
@ -32,7 +35,7 @@ class Credentials extends Base {
|
||||
},
|
||||
}
|
||||
);
|
||||
if (data.next) {
|
||||
if (data.next && requestCounter <= maxRequests) {
|
||||
return fetchInputSources(
|
||||
pageNo + 1,
|
||||
inputSources.concat(data.results)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user