fix: delay nginx:reload file mod effect by 10 seconds (#1512)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Enhancements**
  * Added logging to indicate when Nginx is successfully reloaded.
* Introduced a 10-second delay with a log message before triggering
Nginx reloads in file modification effects.

* **Style**
* Removed a startup message from the Unraid API service plugin
installation process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Eli Bosley <ekbosley@gmail.com>
This commit is contained in:
Pujit Mehrotra
2025-07-14 11:12:20 -04:00
committed by GitHub
parent 85a35804c1
commit af33e999a0
2 changed files with 6 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ export class NginxService {
async reload() { async reload() {
try { try {
await execa('/etc/rc.d/rc.nginx', ['reload']); await execa('/etc/rc.d/rc.nginx', ['reload']);
this.logger.log('Nginx reloaded');
return true; return true;
} catch (err: unknown) { } catch (err: unknown) {
this.logger.warn('Failed to reload Nginx with error: ', err); this.logger.warn('Failed to reload Nginx with error: ', err);

View File

@@ -1,14 +1,18 @@
import { Injectable } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import { ONE_SECOND_MS } from '@app/consts.js';
import { NginxService } from '@app/unraid-api/nginx/nginx.service.js'; import { NginxService } from '@app/unraid-api/nginx/nginx.service.js';
import { ModificationEffect } from '@app/unraid-api/unraid-file-modifier/file-modification.js'; import { ModificationEffect } from '@app/unraid-api/unraid-file-modifier/file-modification.js';
@Injectable() @Injectable()
export class FileModificationEffectService { export class FileModificationEffectService {
private readonly logger = new Logger(FileModificationEffectService.name);
constructor(private readonly nginxService: NginxService) {} constructor(private readonly nginxService: NginxService) {}
async runEffect(effect: ModificationEffect): Promise<void> { async runEffect(effect: ModificationEffect): Promise<void> {
switch (effect) { switch (effect) {
case 'nginx:reload': case 'nginx:reload':
this.logger.log('Reloading Nginx in 10 seconds...');
await new Promise((resolve) => setTimeout(resolve, 10 * ONE_SECOND_MS));
await this.nginxService.reload(); await this.nginxService.reload();
break; break;
} }