From 81822dfd1c39710dae80f7d41d2b4576d766de17 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 10 Jun 2020 14:28:32 -0400 Subject: [PATCH] Adds an upper limit on recursive calls set statically in the method at 5. --- awx/ui_next/src/api/models/Credentials.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/ui_next/src/api/models/Credentials.js b/awx/ui_next/src/api/models/Credentials.js index 4ccf8d25c3..1f369e7a77 100644 --- a/awx/ui_next/src/api/models/Credentials.js +++ b/awx/ui_next/src/api/models/Credentials.js @@ -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)