Skip to content

Commit

Permalink
Update loopback_test.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani authored Feb 10, 2025
1 parent 6eeb75b commit 006e2e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/loopback_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@ while true; do
--data-raw "$data_payload"

# Print the payload for debugging
echo "Payload sent: $data_payload"
# echo "Payload sent: $data_payload"

# Increment counter
((counter++))

# Every 10 inserts, check the total count
if (( counter % 10 == 0 )); then
if (( counter % 50 == 0 )); then
query_payload=$(jq -n --arg time "$start_time" '{query: "SELECT count() as count, avg(temp) as temp FROM home WHERE time >= '\''\($time)'\'' LIMIT 1"}')
response=$(curl -s -X POST "$QUERY_URL" -H "Content-Type: application/json" -d "$query_payload")
echo "Total count: $response"
echo "Total sent: $counter"
fi

# Wait for 1 second before sending the next request
sleep 1
read -t 0.5

done

0 comments on commit 006e2e2

Please sign in to comment.