Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backend] Fix connectors work cleanup perf (#6031) #6203

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions opencti-platform/opencti-graphql/src/database/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,7 @@ export const elAggregationsList = async (context, user, indexName, aggregations,

export const elPaginate = async (context, user, indexName, options = {}) => {
// eslint-disable-next-line no-use-before-define
const { baseData = false, bypassSizeLimit = false, first = ES_DEFAULT_PAGINATION } = options;
const { baseData = false, baseFields = BASE_FIELDS, bypassSizeLimit = false, first = ES_DEFAULT_PAGINATION } = options;
const { types = null, connectionFormat = true } = options;
const body = await elQueryBodyBuilder(context, user, options);
if (body.size > ES_MAX_PAGINATION && !bypassSizeLimit) {
Expand All @@ -2717,7 +2717,7 @@ export const elPaginate = async (context, user, indexName, options = {}) => {
const query = {
index: indexName,
track_total_hits: true,
_source: baseData ? BASE_FIELDS : true,
_source: baseData ? baseFields : true,
body,
};
logApp.debug('[SEARCH] paginate', { query });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@
filters,
noFiltersChecking: true,
types: ['Work'],
orderBy: 'timestamp',

Check warning on line 70 in opencti-platform/opencti-graphql/src/manager/connectorManager.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/manager/connectorManager.js#L70

Added line #L70 was not covered by tests
connectionFormat: false,
baseData: true,
baseFields: ['internal_id', 'timestamp'],

Check warning on line 73 in opencti-platform/opencti-graphql/src/manager/connectorManager.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/manager/connectorManager.js#L72-L73

Added lines #L72 - L73 were not covered by tests
callback: queryCallback
});
}
Expand All @@ -93,8 +96,11 @@
await elList(context, SYSTEM_USER, [INDEX_HISTORY], {
filters,
types: ['Work'],
orderBy: 'timestamp',

Check warning on line 99 in opencti-platform/opencti-graphql/src/manager/connectorManager.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/manager/connectorManager.js#L99

Added line #L99 was not covered by tests
noFiltersChecking: true,
connectionFormat: false,
baseData: true,
baseFields: ['internal_id'],

Check warning on line 103 in opencti-platform/opencti-graphql/src/manager/connectorManager.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/manager/connectorManager.js#L102-L103

Added lines #L102 - L103 were not covered by tests
callback: queryCallback
});
};
Expand Down