On Mar 13, 4:54 am, Seth <seedifferen...@gmail.com> wrote: > I was advised a while back by someone to throw my MongoDB connection call > into a pyramid.events.NewRequest subscriber. However, this has proven to be > a bad idea because the NewRequest subscriber gets called even if the request > is a static_route request, and since the event.request object in the > NewRequest subscriber doesn't have a matched_route attribute, there's no > bullet-proof way to filter those out. > > How are other people connecting to a db with high-traffic sites using > Pyramid and avoiding the static_route re-connection nonsense? Perhaps we > could request to get a matched_route object on the NewRequest event object? > If it were me I would attach a connection factory instead of an open connection. The factory would open a connection and stash it on the request the first time it is invoked and then just return the stashed connection on subsequent calls. This preserves the convenience of your pattern but allows you to only cause a connection to be opened for requests that need it.
Chris -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.