So I'm creating a file uploader and just like all other file uploaders it needs to scan files from vira and that is done with the following command:const scanner = spawn("/opt/sophos-av/bin/savscan", ["-nc", "-nb", "-ss", "-remove", "-archive", "-suspicious", fullPath]);The function that this is called in is called after a user uploads a file, and it's called in an async manner so that the user gets the link to the file before it has finished scanning (that is the requirement).Now what I had forgotten to think about (and am happy that I didn't catch in production) is the fact that spawn will continue to create new processes no matter what. This I learned when I tried uploading 198 files and suddenly found my desktop running 198 sophos processes and being for all intents and purposes unusable.I am not really sure what would be a good idea to do about it. I mean I could have another node instance that acts as a queue to limit the amount of simultaneous scans to 20 or something like that.
Submitted August 03, 2018 at 02:28AM by inabahare
No comments:
Post a Comment