mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-29 15:57:00 +02:00
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:
parent
88b87191e5
commit
fb94b779c8
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ describe('GlobalConfig', () => {
|
|||
editorBaseUrl: '',
|
||||
dataTable: {
|
||||
maxSize: 50 * 1024 * 1024,
|
||||
warningThreshold: 45 * 1024 * 1024,
|
||||
sizeCheckCacheDuration: 60000,
|
||||
},
|
||||
database: {
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user