|
@@ -517,8 +517,17 @@ export class WatcherService implements OnModuleDestroy {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async stop() {
|
|
async stop() {
|
|
|
- if (this.watcher && this.isWatching) {
|
|
|
|
|
- await this.watcher.close();
|
|
|
|
|
|
|
+ // If status shows we're watching, force stop regardless of watcher object state
|
|
|
|
|
+ if (this.isWatching) {
|
|
|
|
|
+ if (this.watcher) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await this.watcher.close();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ this.logger.warn(`Error closing watcher: ${error.message}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.watcher = null;
|
|
|
this.isWatching = false;
|
|
this.isWatching = false;
|
|
|
this.eventsGateway.emitWatcherUpdate({ type: 'stopped' });
|
|
this.eventsGateway.emitWatcherUpdate({ type: 'stopped' });
|
|
|
|
|
|