commit 6ea01444dd75d2d15658c808e052143deaf66543
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri May 24 09:32:41 2019 +0000
Add Timer context manager class
This class creates a context that:
* Triggers a timeout exception if the timeout is set.
* Returns the time elapsed since the context was initialized.
* Returns the time spent in the context once it's closed.
The timeout exception can be suppressed; when the time expires, the
context finishes without rising TimerTimeout.
This class can be used to execute blocking methods and finish them if
there is no return. For example, in the followup patch [1], this class
is used in the method "neutron.agent.linux.ip_lib.ip_monitor" to control
how much time the blocking function "IPRSocket.get" is being called. By
using this strategy the method "ip_monitor" can be finished gracefully
using an external event signal in the main loop.
Reviewed: https:/ /review. opendev. org/661257 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=6ea01444dd7 5d2d15658c808e0 52143deaf66543
Committed: https:/
Submitter: Zuul
Branch: master
commit 6ea01444dd75d2d 15658c808e05214 3deaf66543
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri May 24 09:32:41 2019 +0000
Add Timer context manager class
This class creates a context that:
* Triggers a timeout exception if the timeout is set.
* Returns the time elapsed since the context was initialized.
* Returns the time spent in the context once it's closed.
The timeout exception can be suppressed; when the time expires, the
context finishes without rising TimerTimeout.
This class can be used to execute blocking methods and finish them if agent.linux. ip_lib. ip_monitor" to control
there is no return. For example, in the followup patch [1], this class
is used in the method "neutron.
how much time the blocking function "IPRSocket.get" is being called. By
using this strategy the method "ip_monitor" can be finished gracefully
using an external event signal in the main loop.
[1] https:/ /review. opendev. org/#/c/ 660611/
Change-Id: I1f33535b201d49 b875437bcc3397f cb465118064
Related-Bug: #1680183