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:
Updated instance of .length.run to .size.run. Both of these get a count of rows in the db, but the former will be deprecated in the future, and we should keep things consistent!
A few functions were simplified, mostly for clarity. Primarily in DBTableDefinitions.scala and SurveyQuestionTable.scala
Fixed a couple instances of nested transactions (#3550) in LabelTable.scala and MissionTable.scala
Things to check before submitting the PR
[x] I've written a descriptive PR title.
[x] I've added/updated comments for large or confusing blocks of code.
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 towithSession
. 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:
.length.run
to.size.run
. Both of these get a count of rows in the db, but the former will be deprecated in the future, and we should keep things consistent!DBTableDefinitions.scala
andSurveyQuestionTable.scala
LabelTable.scala
andMissionTable.scala
Things to check before submitting the PR