Skip to content

Commit

Permalink
refactor: small rename, console to logger and unnecessary as conversi…
Browse files Browse the repository at this point in the history
…on changes
  • Loading branch information
Meierschlumpf committed Sep 24, 2024
1 parent 9e63f2a commit e98d666
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/router/widgets/dns-hole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import type { IntegrationKindByCategory, WidgetKind } from "@homarr/definitions"
import { getIntegrationKindsByCategory } from "@homarr/definitions";
import { integrationCreator } from "@homarr/integrations";
import type { DnsHoleSummary } from "@homarr/integrations/types";
import { controlsInputSchema } from "@homarr/integrations/types";
import { createItemAndIntegrationChannel } from "@homarr/redis";
import { z } from "@homarr/validation";

import { controlsInputSchema } from "../../../../integrations/src/pi-hole/pi-hole-types";
import { createManyIntegrationMiddleware, createOneIntegrationMiddleware } from "../../middlewares/integration";
import { createTRPCRouter, publicProcedure } from "../../trpc";

Expand All @@ -20,7 +20,7 @@ export const dnsHoleRouter = createTRPCRouter({
.query(async ({ input: { widgetKind }, ctx }) => {
const results = await Promise.all(
ctx.integrations.map(async ({ decryptedSecrets: _, ...integration }) => {
const channel = createItemAndIntegrationChannel<DnsHoleSummary>(widgetKind as WidgetKind, integration.id);
const channel = createItemAndIntegrationChannel<DnsHoleSummary>(widgetKind, integration.id);
const { data: summary, timestamp } = (await channel.getAsync()) ?? { data: null, timestamp: new Date(0) };

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/cron-jobs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { analyticsJob } from "./jobs/analytics";
import { iconsUpdaterJob } from "./jobs/icons-updater";
import { dnsHoleJob } from "./jobs/integrations/dnsHole";
import { dnsHoleJob } from "./jobs/integrations/dns-hole";
import { downloadsJob } from "./jobs/integrations/downloads";
import { smartHomeEntityStateJob } from "./jobs/integrations/home-assistant";
import { indexerManagerJob } from "./jobs/integrations/indexer-manager";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { db } from "@homarr/db";
import { getItemsWithIntegrationsAsync } from "@homarr/db/queries";
import { integrationCreatorFromSecrets } from "@homarr/integrations";
import type { DnsHoleSummary } from "@homarr/integrations/types";
import { logger } from "@homarr/log";
import { createItemAndIntegrationChannel } from "@homarr/redis";

import { createCronJob } from "../../lib";
Expand All @@ -21,7 +22,7 @@ export const dnsHoleJob = createCronJob("dnsHole", EVERY_5_SECONDS).withCallback
const channel = createItemAndIntegrationChannel<DnsHoleSummary>(itemForIntegration.kind, integration.id);
await channel.publishAndUpdateLastStateAsync(data);
})
.catch((error) => console.error(`Could not retrieve data for ${integration.name}: "${error}"`));
.catch((error) => logger.error(`Could not retrieve data for ${integration.name}: "${error}"`));
}
}
});
1 change: 1 addition & 0 deletions packages/integrations/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./calendar-types";
export * from "./interfaces/dns-hole-summary/dns-hole-summary-types";
export * from "./interfaces/indexer-manager/indexer";
export * from "./interfaces/media-requests/media-request";
export * from "./pi-hole/pi-hole-types";

0 comments on commit e98d666

Please sign in to comment.