fix: address v2 stack review findings
This commit is contained in:
1 parent
53b518960c
commit
263702210a
48 files changed
+1235
-530
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { mapWithConcurrency } from "@homarr/common";
|
||||
import { ResponseError } from "@homarr/common/server";
|
||||
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
@@ -32,6 +33,7 @@ const UMAMI_CUSTOM_EVENT_TYPE = 2;
|
||||
const UMAMI_EVENT_NAME_LIMIT = 5_000;
|
||||
const UMAMI_EVENT_PAGE_SIZE = 5_000;
|
||||
const UMAMI_EVENT_PAGE_MAX = 20;
|
||||
const UMAMI_EVENT_REQUEST_CONCURRENCY = 4;
|
||||
|
||||
const logger = createLogger({ module: "umami-integration" });
|
||||
|
||||
@@ -245,8 +247,7 @@ export class UmamiIntegration extends Integration {
|
||||
): Promise<UmamiEventSeries[]> {
|
||||
const authHeaders = await this.getAuthHeadersAsync();
|
||||
const { startAt, endAt, unit } = this.computeTimeRange(timeFrame);
|
||||
const results: UmamiEventSeries[] = [];
|
||||
for (const eventName of eventNames) {
|
||||
return mapWithConcurrency(eventNames, UMAMI_EVENT_REQUEST_CONCURRENCY, async (eventName) => {
|
||||
const dataPoints = await this.getWebsiteEventTimeSeriesAsync(
|
||||
websiteId,
|
||||
startAt,
|
||||
@@ -255,9 +256,8 @@ export class UmamiIntegration extends Integration {
|
||||
eventName,
|
||||
authHeaders,
|
||||
);
|
||||
results.push({ eventName, dataPoints: dataPoints ?? [] });
|
||||
}
|
||||
return results;
|
||||
return { eventName, dataPoints: dataPoints ?? [] };
|
||||
});
|
||||
}
|
||||
|
||||
private async getWebsiteEventMetricsAsync(
|
||||
|
||||
Reference in new issue
Block a user