Skip to content

Commit

Permalink
update: cache all request for 1minute and keep pg pools alive for 1mi…
Browse files Browse the repository at this point in the history
…nute, log errors and warns
  • Loading branch information
Uhuh committed May 26, 2024
1 parent 2dbeab5 commit 0f2ec43
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,17 @@ export class RoleBot extends Discord.Client {
port: 5432,
database: config.POSTGRES_DATABASE,
entities: [ReactMessage, ReactRole, Category, GuildConfig, JoinRole],
logging: false,
logging: ['error', 'warn'],
synchronize: config.SYNC_DB,
poolErrorHandler: (error) => {
this.log.error(`DataSource pool error. Cluster[${getInfo().CLUSTER}]\n${error}`);
},
extra: {
idleTimeoutMillis: 60000,
},
cache: {
duration: 60_000,
}
});

await dataSource.initialize()
Expand Down

0 comments on commit 0f2ec43

Please sign in to comment.