The get_routers method in the l3 RPC code has a log.debug
statement that formats all of the router data as indented
JSON. This method can be expensive if there are hundreds
of routers being synced and it happens even if debugging
is disabled since the function call result is the parameter
to the debug statement.
This patch adds and leverages a small helper class that takes a
callable and its args and defers calling it until the __str__ method
is called on it when it's actually trying to be rendered to a string.
Change-Id: I2bfceb286ce30f2a3595381b62bdc6dd71ed8483
Partial-Bug: #1445412
(cherry picked from commit 649599457e29b58ad0aec9ace990e0a2b59b05d0)
Reviewed: https:/ /review. openstack. org/176451 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=aafe03f30b7 5c4f4e255f295c3 52e9eb2f2e1110
Committed: https:/
Submitter: Jenkins
Branch: stable/juno
commit aafe03f30b75c4f 4e255f295c352e9 eb2f2e1110
Author: Kevin Benton <email address hidden>
Date: Fri Apr 17 03:53:45 2015 -0700
Defer creation of router JSON in get_routers RPC
The get_routers method in the l3 RPC code has a log.debug
statement that formats all of the router data as indented
JSON. This method can be expensive if there are hundreds
of routers being synced and it happens even if debugging
is disabled since the function call result is the parameter
to the debug statement.
This patch adds and leverages a small helper class that takes a
callable and its args and defers calling it until the __str__ method
is called on it when it's actually trying to be rendered to a string.
Change-Id: I2bfceb286ce30f 2a3595381b62bdc 6dd71ed8483 ad0aec9ace990e0 a2b59b05d0)
Partial-Bug: #1445412
(cherry picked from commit 649599457e29b58