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/176450 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=58af5e101d3 0027549bda93085 36e9f45ed0bfef
Committed: https:/
Submitter: Jenkins
Branch: stable/kilo
commit 58af5e101d30027 549bda9308536e9 f45ed0bfef
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