|
|
@ -45,14 +45,26 @@ const config = reactive<ERDConfig>({ |
|
|
|
isFullScreen: false, |
|
|
|
isFullScreen: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const loadMetaOfTablesNotInMetas = async (localTables: TableType[]) => { |
|
|
|
const fetchMissingTableMetas = async (localTables: TableType[]) => { |
|
|
|
await Promise.all( |
|
|
|
const chunkSize = 5 |
|
|
|
localTables |
|
|
|
|
|
|
|
.filter((table) => !metas.value[table.id!]) |
|
|
|
// Function to process a chunk of tables |
|
|
|
.map(async (table) => { |
|
|
|
const processChunk = async (chunk: TableType[]) => { |
|
|
|
|
|
|
|
await Promise.all( |
|
|
|
|
|
|
|
chunk.map(async (table) => { |
|
|
|
await getMeta(table.id!) |
|
|
|
await getMeta(table.id!) |
|
|
|
}), |
|
|
|
}), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// filter out tables that are already loaded and are not from the same source |
|
|
|
|
|
|
|
const filteredTables = localTables.filter((t) => !metas.value[t.id!] && t.source_id === props.sourceId) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Split the tables into chunks and process each chunk sequentially to avoid hitting throttling limits |
|
|
|
|
|
|
|
for (let i = 0; i < filteredTables.length; i += chunkSize) { |
|
|
|
|
|
|
|
const chunk = filteredTables.slice(i, i + chunkSize) |
|
|
|
|
|
|
|
await processChunk(chunk) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const populateTables = async () => { |
|
|
|
const populateTables = async () => { |
|
|
@ -73,7 +85,7 @@ const populateTables = async () => { |
|
|
|
localTables = baseTables.value |
|
|
|
localTables = baseTables.value |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await loadMetaOfTablesNotInMetas(localTables) |
|
|
|
await fetchMissingTableMetas(localTables) |
|
|
|
|
|
|
|
|
|
|
|
tables.value = localTables |
|
|
|
tables.value = localTables |
|
|
|
.filter( |
|
|
|
.filter( |
|
|
|