I am trying to use RxJS to write a script to process several hundred log files, each of which is about 1 GB. The skeleton script looks like
Rx.Observable.from(arrayOfLogFilePath) .flatMap(function(logFilePath){ return Rx.Node.fromReadStream(logFilePath) .filter(filterLogLine) }) .groupBy(someGroupingFunc) .map(someFurtherProcessing) .subscribe(...)
The code works, but note that the filtering step of all log files will start at the same time. However, in terms of IO file system performance, it is advisable to process one file after another (or at least limit concurrency to several files, rather than opening all hundreds of files at the same time). In this regard, how can I implement it in a “functional reactive manner”?
I was thinking about a planner, but could not figure out how this could help here.
source share