Why not use inversify to create file watcher server?

As this line shows

instead of using inversify to bind the concrete file watcher server class to the interface, we use the keyword ‘new’ to create an instance.

Is there any reason behind that? Your help is greatly appreciated.

[original thread by Liang]

Since file watching is slow and tend to block the backend for big workspaces, it is executed not in the server process, but in forked process without inversify

see nsfw-watcher/index.ts file

Do you have problems with that?

Code which you mentioned is used only during debugging, not in production.

Also, NsfwFileSystemWatcherServer is used in worker processes without any inversify constructs, and it doesn’t seem to depend on inversify things either (no @inject() or @injectable()), other than some loggers maybe.

And as Anton said, the isMaster branch will only trigger in no-cluster mode, that we most often use when debugging. Otherwise, the instance will be created in sub-workers, instead of inside the backend process, to offload the work done by nsfw when watching.