ProjectSidewalk / SidewalkWebpage

Project Sidewalk web page
http://projectsidewalk.org
MIT License
84 stars 25 forks source link

Small query performance improvements #3741

Closed misaugstad closed 3 days ago

misaugstad commented 3 days ago

Working on #3726

We've had some back end db issues since switching to unified login. I was looking at some logs today as Teaneck is currently down. I'm seeing a lot of errors about not being able to find free/available db connections.

One small thing I'm trying here is to change a bunch of instances where we're using withTransaction and switching it to withSession. I think that in some cases this may result in essentially a lock being taken out on a table, preventing it from being used by other processes, which could be slowing down the system.

It looked like Teaneck may have gone down while running nightly clustering, and I took a quick peek at the code and noticed that we were using withTransaction often there unnecessarily, which is why I started making this change. I'm honestly not expecting it to really help, but you never know! And it's something that we've needed to do anyway.

Other small updates:

Things to check before submitting the PR