fix: avoid watching too many files
This fixes issue #20644 Signed-off-by: David Festal <dfestal@redhat.com>
This commit is contained in:
@@ -174,7 +174,7 @@ export class PluginManager implements BackendPluginProvider {
|
||||
config: Config,
|
||||
logger: LoggerService,
|
||||
preferAlpha?: boolean,
|
||||
mooduleLoader?: ModuleLoader,
|
||||
moduleLoader?: ModuleLoader,
|
||||
): Promise<PluginManager>;
|
||||
// (undocumented)
|
||||
readonly plugins: DynamicPlugin[];
|
||||
|
||||
@@ -49,7 +49,7 @@ export class PluginManager implements BackendPluginProvider {
|
||||
config: Config,
|
||||
logger: LoggerService,
|
||||
preferAlpha: boolean = false,
|
||||
mooduleLoader: ModuleLoader = new CommonJSModuleLoader(logger),
|
||||
moduleLoader: ModuleLoader = new CommonJSModuleLoader(logger),
|
||||
): Promise<PluginManager> {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
const backstageRoot = findPaths(__dirname).targetRoot;
|
||||
@@ -61,7 +61,7 @@ export class PluginManager implements BackendPluginProvider {
|
||||
);
|
||||
const scannedPlugins = await scanner.scanRoot();
|
||||
scanner.trackChanges();
|
||||
const manager = new PluginManager(logger, scannedPlugins, mooduleLoader);
|
||||
const manager = new PluginManager(logger, scannedPlugins, moduleLoader);
|
||||
|
||||
const dynamicPluginsPaths = scannedPlugins.map(p =>
|
||||
fs.realpathSync(
|
||||
@@ -73,7 +73,7 @@ export class PluginManager implements BackendPluginProvider {
|
||||
),
|
||||
);
|
||||
|
||||
mooduleLoader.bootstrap(backstageRoot, dynamicPluginsPaths);
|
||||
moduleLoader.bootstrap(backstageRoot, dynamicPluginsPaths);
|
||||
|
||||
scanner.subscribeToRootDirectoryChange(async () => {
|
||||
manager._availablePackages = await scanner.scanRoot();
|
||||
|
||||
@@ -217,6 +217,8 @@ export class PluginScanner {
|
||||
.watch(this._rootDirectory, {
|
||||
ignoreInitial: true,
|
||||
followSymlinks: true,
|
||||
depth: 1,
|
||||
disableGlobbing: true,
|
||||
})
|
||||
.on(
|
||||
'all',
|
||||
|
||||
Reference in New Issue
Block a user