Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
pika
Commits
ea447a26d150
Commit
ea447a26d150
authored
7 years ago
by
Luke Bakken
Browse files
Options
Downloads
Patches
Plain Diff
Rather than double the negotiated timeout to calculate the check interval, use 5 additional seconds
parent
2612681c25dd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pika/heartbeat.py
+8
-4
8 additions, 4 deletions
pika/heartbeat.py
tests/unit/heartbeat_tests.py
+1
-1
1 addition, 1 deletion
tests/unit/heartbeat_tests.py
with
9 additions
and
5 deletions
pika/heartbeat.py
+
8
−
4
View file @
ea447a26
...
...
@@ -52,9 +52,13 @@
self
.
_send_interval
=
float
(
timeout
)
/
2
# Note: Pika doubles the negotiated timeout to match the behavior of the
# RabbitMQ Java client and the spec that suggests a check interval equivalent
# to two times the heartbeat timeout value.
# Note: Pika will calculate the heartbeat / connectivity check interval
# by adding 5 seconds to the negotiated timeout to leave a bit of room
# for broker heartbeats that may be right at the edge of the timeout
# window. This is different behavior from the RabbitMQ Java client and
# the spec that suggests a check interval equivalent to two times the
# heartbeat timeout value. But, one advantage of adding a small amount
# is that bad connections will be detected faster.
# https://github.com/pika/pika/pull/1072#issuecomment-397850795
# https://github.com/rabbitmq/rabbitmq-java-client/blob/b55bd20a1a236fc2d1ea9369b579770fa0237615/src/main/java/com/rabbitmq/client/impl/AMQConnection.java#L773-L780
# https://github.com/ruby-amqp/bunny/blob/3259f3af2e659a49c38c2470aa565c8fb825213c/lib/bunny/session.rb#L1187-L1192
...
...
@@ -58,7 +62,7 @@
# https://github.com/pika/pika/pull/1072#issuecomment-397850795
# https://github.com/rabbitmq/rabbitmq-java-client/blob/b55bd20a1a236fc2d1ea9369b579770fa0237615/src/main/java/com/rabbitmq/client/impl/AMQConnection.java#L773-L780
# https://github.com/ruby-amqp/bunny/blob/3259f3af2e659a49c38c2470aa565c8fb825213c/lib/bunny/session.rb#L1187-L1192
self
.
_check_interval
=
float
(
timeout
)
*
2
self
.
_check_interval
=
timeout
+
5
LOGGER
.
debug
(
'
timeout: %f send_interval: %f check_interval: %f
'
,
self
.
_timeout
,
...
...
This diff is collapsed.
Click to expand it.
tests/unit/heartbeat_tests.py
+
1
−
1
View file @
ea447a26
...
...
@@ -12,7 +12,7 @@
INTERVAL
=
60
SEND_INTERVAL
=
float
(
INTERVAL
)
/
2
CHECK_INTERVAL
=
float
(
INTERVAL
)
*
2
CHECK_INTERVAL
=
INTERVAL
+
5
def
setUp
(
self
):
self
.
mock_conn
=
mock
.
Mock
(
spec
=
connection
.
Connection
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment