Skip to content

Commit

Permalink
Use itemscount file
Browse files Browse the repository at this point in the history
  • Loading branch information
phillmac committed Jun 4, 2021
1 parent a00eab9 commit f152739
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ function runWorker () {

while :
do
((count=0))
node src/scrape-cli.js --torrent-hashes-stdin-ln < <(
((count=0))
while read -r fetched_item
do
if [[ -n "${fetched_item}" ]]
then
echo "Got item ${fetched_item} [${count}/${recycle_count}]" >&2
echo "${fetched_item}"
((count++))
echo "${count}" > /dev/shm/itemscount
fi
done < <(
while ((count <= recycle_count))
while itemscount=$(</dev/shm/itemscount) && ((itemscount <= recycle_count))
do
curl --silent "${fetch_url}"
((count++))
sleep 1
done
)
Expand Down

0 comments on commit f152739

Please sign in to comment.