#4353 Root controllers shouldn't query each neighborhood for every request

v1.0.0
closed
sf-2 (994)
General
2015-08-20
2012-06-12
No

In root.py, RootController __init__ loops through each neighborhood and binds it. And the bind creates a NeighborhoodController which does a query for the neighborhood. As far as I can tell, it does this for every request. I see two opportunities for improvement:

  • pass the Neighborhood object through the binding calls, so it doesn't have to be queried again in the nbhd __init__ method
  • change the root controller's bind loop to only happen once (at the class level, or as a lazy/cached property, rather than every time in the __init__)

The paster command to create new neighborhoods should print out a message explaining that the webserver needs to be restarted for the new neighborhood urls to work.

Discussion

  • Dave Brondsema

    Dave Brondsema - 2012-06-15
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -2,3 +2,5 @@
    
     * pass the Neighborhood object through the binding calls, so it doesn't have to be queried again in the nbhd `__init__` method
     * change the root controller's bind loop to only happen once (at the class level, or as a lazy/cached property, rather than every time in the `__init__`)
    +
    +The paster command to create new neighborhoods should print out a message explaining that the webserver needs to be restarted for the new neighborhood urls to work.
    
    • size: --> 2
     
  • Jenny Steele - 2012-06-18
    • status: open --> in-progress
    • assigned_to: Jenny Steele
     
  • Jenny Steele - 2012-06-18
    • status: in-progress --> code-review
    • qa: Tim Van Steenburgh
     
  • Jenny Steele - 2012-06-18

    On allura js/4353. If you put a log msg in the NeighborhoodController init, you should see it called only once for each neighborhood in each thread (six messages total on my sb with 3 neighborhoods). Additional reloads after that will not init new NeighborhoodControllers.

     
    • status: code-review --> closed
     
  • Nice.

     

Log in to post a comment.