-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[change] Random pause for every 10 successfull sent requests #131
Conversation
@@ -195,6 +197,11 @@ send_data() { | |||
done | |||
# retry sending same data again in next cycle | |||
[ "$failures" -eq "$MAX_RETRIES" ] && break | |||
# pause for a while after every 10 successful request sent | |||
if [ $((success_count % 10)) -eq 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't 0 % 10 == 0
? Why not just use [ $success_rate -ge 10 ]
which is more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-ge
makes it run whenever the success_rate
is more than or equal to 10. But as per the issue, it was meant for every 10 requests. Was I right on this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requirement is to pause every 10 successful requests.
I don't see any success_rate
variable in this diff, @pandafy where is success_rate
coming from?
I only see success_count
here.
@@ -118,6 +118,7 @@ handle_sigusr1() { | |||
} | |||
|
|||
send_data() { | |||
success=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After having reviewed the code I think you were right in setting this to zero, my calculation was incorrect.
Closes #128