Increase Limit query lookup applications and filter_apps = numeric
This commit is contained in:
1 parent
c34f4be002
commit
1e16ec6eb8
1 file changed
+10
-6
@@ -44,21 +44,25 @@ async function populateAppCache(BASE_URL, token, siteUuid) {
|
||||
const headers = { 'x-api-key': token, 'Accept': 'application/json' };
|
||||
if (siteUuid) headers['x-net-site'] = siteUuid;
|
||||
const res = await axios.get(`${BASE_URL}/lookup/applications`, {
|
||||
headers, params: { settings_limit: 2000 }, timeout: 8000
|
||||
headers, params: { settings_limit: 5000 }, timeout: 20000
|
||||
});
|
||||
appLookupCache = {};
|
||||
if (res.data && Array.isArray(res.data.data)) {
|
||||
res.data.data.forEach(a => {
|
||||
if (!a.label || !a.id) return;
|
||||
if (!a.id) return;
|
||||
const label = (a.label || '').trim();
|
||||
if (!label) return;
|
||||
let domain = null;
|
||||
if (a.home_page?.url) {
|
||||
domain = a.home_page.url.replace(/^https?:\/\/(www\.)?/, '').split('/')[0];
|
||||
} else if (a.domain_list?.length > 0) {
|
||||
domain = a.domain_list[0].label;
|
||||
} else {
|
||||
domain = a.label.toLowerCase();
|
||||
domain = label.toLowerCase();
|
||||
}
|
||||
appLookupCache[a.label.toLowerCase()] = { id: a.id, label: a.label, domain };
|
||||
const entry = { id: a.id, label, domain };
|
||||
appLookupCache[label.toLowerCase()] = entry;
|
||||
if (a.tag) appLookupCache[a.tag.toLowerCase()] = entry;
|
||||
});
|
||||
}
|
||||
console.log(`[AppDetailsDpiHelper] App cache: ${Object.keys(appLookupCache).length} apps`);
|
||||
@@ -92,12 +96,12 @@ async function fetchFromDpiApi(label, agentUuid, timeRange, token, siteUuid) {
|
||||
|
||||
const params = {
|
||||
filter_interval: timeRangeToMinutes(timeRange),
|
||||
filter_applications: `["${appInfo.id}"]`,
|
||||
filter_applications: `[${appInfo.id}]`,
|
||||
settings_limit: 10000
|
||||
};
|
||||
|
||||
if (agentUuid && agentMapCache?.[agentUuid]) {
|
||||
params.filter_agents = `[${agentMapCache[agentUuid]}]`;
|
||||
params.filter_agents = `["${agentMapCache[agentUuid]}"]`;
|
||||
}
|
||||
|
||||
const [dlRes, ulRes] = await Promise.all([
|
||||
|
||||
Reference in new issue
Block a user