mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
🐛 Fix performance issue with credentials loading (#2130)
This commit is contained in:
@@ -261,15 +261,23 @@ export function getCredentialsDataWithParents(type: string): ICredentialsTypeDat
|
||||
* @param {IWorkflowCredentials} credentials The credentials which have to be able to be resolved
|
||||
* @returns {ICredentialsTypeData}
|
||||
*/
|
||||
export function getCredentialsData(credentials: IWorkflowCredentials): ICredentialsTypeData {
|
||||
export function getCredentialsDataByNodes(nodes: INode[]): ICredentialsTypeData {
|
||||
|
||||
const credentialTypeData: ICredentialsTypeData = {};
|
||||
|
||||
for (const credentialType of Object.keys(credentials)) {
|
||||
if (credentialTypeData[credentialType] !== undefined) {
|
||||
continue;
|
||||
}
|
||||
for (const node of nodes) {
|
||||
const credentialsUsedByThisNode = node.credentials;
|
||||
if (credentialsUsedByThisNode) {
|
||||
// const credentialTypesUsedByThisNode = Object.keys(credentialsUsedByThisNode!);
|
||||
for (const credentialType of Object.keys(credentialsUsedByThisNode!)) {
|
||||
if (credentialTypeData[credentialType] !== undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object.assign(credentialTypeData, getCredentialsDataWithParents(credentialType));
|
||||
Object.assign(credentialTypeData, getCredentialsDataWithParents(credentialType));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return credentialTypeData;
|
||||
|
||||
Reference in New Issue
Block a user