I have a firstore with more than 20.000 documents. If I want to restore them I get the following error after some time Auth error:Error: connect ENFILE 172.217.21.202:443 - Local (undefined:undefined). This seems to stem from the fact that too many files are opened and macOS stops this.
Another problem was that the node process was eating up memory (> 1GB).
Solution
I refactored the code, so that it gets all files at first, puts them in chunks of 20 and then runs the chunks in serial. The 20 documents in one chunk are saved in parallel.
The new code runs pretty fast (3 mins for ~ 20.000 docs) and uses less memory (100 - 120 MB)
Open Qustions
I don't know what chunk size is appropriate. 20 was a guess. Maybe more makes sense? Is there a limit from firebase?
Problem
I have a firstore with more than 20.000 documents. If I want to restore them I get the following error after some time
Auth error:Error: connect ENFILE 172.217.21.202:443 - Local (undefined:undefined)
. This seems to stem from the fact that too many files are opened and macOS stops this.Another problem was that the node process was eating up memory (> 1GB).
Solution
I refactored the code, so that it gets all files at first, puts them in chunks of 20 and then runs the chunks in serial. The 20 documents in one chunk are saved in parallel.
The new code runs pretty fast (3 mins for ~ 20.000 docs) and uses less memory (100 - 120 MB)
Open Qustions
I don't know what chunk size is appropriate. 20 was a guess. Maybe more makes sense? Is there a limit from firebase?