Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
feat: prefetch now configureable
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Feb 25, 2024
1 parent 91ed272 commit da2a883
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions services/kanao-cache/src/Structures/KanaoCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { drizzle } from "drizzle-orm/node-postgres";
import pg from "pg";
import { ListenerStore } from "../Stores/ListenerStore.js";
import { createLogger } from "../Utilities/Logger.js";
import { clientId, storeLogs, lokiHost, databaseUrl, amqp, databaseConnectionLimit } from "../config.js";
import { clientId, storeLogs, lokiHost, databaseUrl, amqp, databaseConnectionLimit, prefetchCount } from "../config.js";

export class KanaoCache extends EventEmitter {
public cacheQueue = createAmqpChannel(amqp, {
Expand Down Expand Up @@ -45,7 +45,7 @@ export class KanaoCache extends EventEmitter {
const routingKey = new RoutedQueue(GatewayExchangeRoutes.RECEIVE, clientId, "cache");
const { queue } = await channel.assertQueue(routingKey.queue, { durable: false });

await channel.prefetch(1);
await channel.prefetch(prefetchCount);
await channel.bindQueue(queue, "kanao-gateway", routingKey.key);
await channel.consume(queue, message => {
if (message) {
Expand Down
2 changes: 2 additions & 0 deletions services/kanao-cache/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export const stateChannels = process.env.STATE_CHANNEL === "true";
export const stateMessages = process.env.STATE_MESSAGE === "true";

export const guildCreateGcEvery = Number(process.env.GUILD_CREATE_GC_EVERY ?? 150);

export const prefetchCount = Number(process.env.PREFETCH_COUNT ?? 50);

0 comments on commit da2a883

Please sign in to comment.