refactor: config caching (#10168)

This commit is contained in:
Jason Rasmussen
2024-06-12 07:07:35 -04:00
committed by GitHub
parent 5dda5d93f5
commit e84657192c
20 changed files with 54 additions and 54 deletions
+5 -5
View File
@@ -68,7 +68,7 @@ export class NotificationService {
throw new HttpException('Failed to verify SMTP configuration', HttpStatus.BAD_REQUEST, { cause: error });
}
const { server } = await this.configCore.getConfig();
const { server } = await this.configCore.getConfig({ withCache: false });
const { html, text } = this.notificationRepository.renderEmail({
template: EmailTemplate.TEST_EMAIL,
data: {
@@ -94,7 +94,7 @@ export class NotificationService {
return JobStatus.SKIPPED;
}
const { server } = await this.configCore.getConfig();
const { server } = await this.configCore.getConfig({ withCache: true });
const { html, text } = this.notificationRepository.renderEmail({
template: EmailTemplate.WELCOME,
data: {
@@ -137,7 +137,7 @@ export class NotificationService {
const attachment = await this.getAlbumThumbnailAttachment(album);
const { server } = await this.configCore.getConfig();
const { server } = await this.configCore.getConfig({ withCache: false });
const { html, text } = this.notificationRepository.renderEmail({
template: EmailTemplate.ALBUM_INVITE,
data: {
@@ -179,7 +179,7 @@ export class NotificationService {
const recipients = [...album.albumUsers.map((user) => user.user), owner].filter((user) => user.id !== senderId);
const attachment = await this.getAlbumThumbnailAttachment(album);
const { server } = await this.configCore.getConfig();
const { server } = await this.configCore.getConfig({ withCache: false });
for (const recipient of recipients) {
const user = await this.userRepository.get(recipient.id, { withDeleted: false });
@@ -220,7 +220,7 @@ export class NotificationService {
}
async handleSendEmail(data: IEmailJob): Promise<JobStatus> {
const { notifications } = await this.configCore.getConfig();
const { notifications } = await this.configCore.getConfig({ withCache: false });
if (!notifications.smtp.enabled) {
return JobStatus.SKIPPED;
}