feat: cap log fetch size and add limit query param

This commit is contained in:
hkfires
2025-11-24 20:53:37 +08:00
parent e3a2a34b70
commit d8c06c7f6c
3 changed files with 21 additions and 1 deletions

View File

@@ -20,8 +20,20 @@ export const logsModule = {
}
let url = '/logs';
const params = new URLSearchParams();
if (incremental && this.latestLogTimestamp) {
url += `?after=${this.latestLogTimestamp}`;
params.set('after', this.latestLogTimestamp);
}
const logFetchLimit = Number.isFinite(this.logFetchLimit) ? this.logFetchLimit : 2500;
if (logFetchLimit > 0) {
params.set('limit', logFetchLimit);
}
const queryString = params.toString();
if (queryString) {
url += `?${queryString}`;
}
const response = await this.makeRequest(url, {