Skip to content

Commit

Permalink
Merge pull request #72 from pelias/paralell-import
Browse files Browse the repository at this point in the history
feat(parallel): Improve parallel import
  • Loading branch information
orangejulius authored Jun 5, 2020
2 parents 32bbcca + c44e8a6 commit 720ed14
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/parallel
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ count=$1
shift

# only do anything if count is a valid integer >= 1
if [[ $count -ge 1 ]]; then
echo "starting $count parallel builds"
if [[ $count -gt 1 ]]; then
echo "CSV importer: starting $count parallel builds"

# spawn $count parallel builds, passing correct params and all arguments
for i in `seq 0 $(($count-1))`; do
cmd="npm start -- --parallel-count $count --parallel-id $i $@ "
cmd="./bin/start --parallel-count $count --parallel-id $i $@"
$cmd &
done

# don't let this script finish until all parallel builds have finished
wait
else
# invalid count value, run normal build
exec ./bin/start $@
fi

0 comments on commit 720ed14

Please sign in to comment.