in reply to Re: Ignoring directories in Catalyst
in thread Ignoring directories in Catalyst

I was just going by what a simple top tells me about resources. "perl" uses more than 12% of the CPU but less than one percent of memory while the server is waiting in restart mode. An strace shows that the server reads the node_modules directory and every file inside it. It reads every directory in the project folder and every file inside those directories, including my .scss files, which it shouldn't be concerned about at all either, though it doesn't read hidden directories. Then it goes into restart mode and sleeps. It does the exact same thing at the end when testing in a project without node_modules, so nothing telling there.

I did find a better workaround than moving my Catalyst files into another subdirectory, though, by moving the node_modules directory somewhere else and symlinking to it. The development server doesn't follow the symlink. While that's not optimal either, it's a less ugly solution.

I'll probably end up filing an issue on Catalyst::Devel. Using things like gulp or grunt is common enough these days. The server doesn't need to be monitoring them. A way to exclude directories and files would be helpful.

Replies are listed 'Best First'.
Re^3: Ignoring directories in Catalyst
by LunarCowgirl (Sexton) on Nov 16, 2014 at 23:20 UTC

    I found a solution to my problem, though from the opposite direction. I had enough free time this weekend to delve into Catalyst's innards and trace the path of the code. The BUILD sub of Catalyst::Restarter is where the list of directories to monitor is set. There's a parameter called "exclude," and it's set to exclude "t" and "root" from monitoring as well as any hidden directories. There appears to be no way to add to or override that list though.

    Catalyst::Script::Server is where the restarter is called, and you can pass a few parameters to it from there, including this one:

    --rdir --restart_directory the directory to search for modified files, can be set multiple times (defaults to '[SCRIPT_DIR]/..')

    So it appears that you can set what directories to monitor but not set what to exclude. I can call the server with --rdir as the "lib" directory instead of the project root, which seems really the only one that needs monitoring anyway, and not have to worry about node_modules or any directories such as those with my Sass files being added to the weight of the server. If I find that anything else needs to be monitored, I can add to it, as --rdir takes an array reference of directories. So calling the server like so works for this problem:

    script/myapp_server.pl --rdir /full/path/to/lib -r

    It still would be nice to have an option to exclude directories, though, for those occasions when you only need to do so to one rather than having to build up a list of multiple approved directories, but at least there's a way to handle the issue.