media-scanner
media-scanner copied to clipboard
TLS causes error if scanning large amount of files
Using TLS command causes some clients to disconnect from the caspar server. For example a node server using casparcg-connection (https://www.npmjs.com/package/casparcg-connection).
The issue seems to be caused by this line in media-scanner/src/app.js :33
const rows = await recursiveReadDirAsync(config.paths.template)
There seems to be some sort of timeout when it has to scan a lot of files and causes a socket disconnect, but still returns status OK.
Possibly related error message:
We use several node services like this and all disconnect at the same time when this error occurs, not just the one sending the command (caspar client works though).
To reproduce:
- Add lots of files to casparcg templates path (30,000 +)
- Use a node service with casparcg-connection package to connect to the server
- Call TLS
- Watch service disconnect
This is why this was moved out of CasparCG server. This way of listing files does simply not work when you have thousands of files... I would suggest you implement your own node service and perform listing through e.g. HTTP instead of through CasparCG.
Or... don't have soo many files in the templates folder
@peterssonanton Add lots of files to casparcg templates path (30,000 +)
Why having that much templates? I'm not sure we have that much. But this could also be the same problem with issue #30 on the other hand. We have to look into this.
Good job @peterssonanton
Its not all templates, but many of our servers are configured to use the caspar root folder as templates path, so the media scanner has to scan all those files including media, images and whatever.
I have exactly the same problem. When scanning a network drive it generates the same problem and cannot detect or access the network folder. We have the entire repository in the same folder and subfolders.