fix(editor): Set warning limit to 80% of max limit for data tables (#20613)

Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
This commit is contained in:
Nikhil Kuriakose 2025-10-10 14:53:21 +02:00 committed by GitHub
parent 88b87191e5
commit fb94b779c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View File

@ -9,9 +9,10 @@ export class DataTableConfig {
/**
* The percentage threshold at which a warning is triggered for data tables.
* When the usage of a data table reaches or exceeds this value, a warning is issued.
* Defaults to 80% of maxSize if not explicitly set via environment variable.
*/
@Env('N8N_DATA_TABLES_WARNING_THRESHOLD_BYTES')
warningThreshold: number = 45 * 1024 * 1024;
warningThreshold?: number;
/**
* The duration in milliseconds for which the data table size is cached.

View File

@ -54,7 +54,6 @@ describe('GlobalConfig', () => {
editorBaseUrl: '',
dataTable: {
maxSize: 50 * 1024 * 1024,
warningThreshold: 45 * 1024 * 1024,
sizeCheckCacheDuration: 60000,
},
database: {

View File

@ -70,9 +70,13 @@ export class DataTableSizeValidator {
}
sizeToState(sizeBytes: number): DataTableSizeStatus {
const warningThreshold =
this.globalConfig.dataTable.warningThreshold ??
Math.floor(0.8 * this.globalConfig.dataTable.maxSize);
if (sizeBytes >= this.globalConfig.dataTable.maxSize) {
return 'error';
} else if (sizeBytes >= this.globalConfig.dataTable.warningThreshold) {
} else if (sizeBytes >= warningThreshold) {
return 'warn';
}
return 'ok';