You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this when I was looking at some other things and this all really needs to be rewritten. It's making a ton of unnecessary SQL calls. I'm guessing this surplus of calls probably is what led to the note about closing old connections. There should be no need to close the connection here because this is absolutely happening within context of the normal request/response lifecycle. The request is probably just prone to timing out due to all the SQL calls which may be leading to stale database connections.
I tried to come up with a clear statement of what I believe to be the business rule at play here:
Given a set of records for which an email message has not been sent, create an email message for each author within that set that includes a list of their records from that set.
There also appears to be a case in which an email message has been created for an author, but before it has been sent more records get added to it. I think we should further consider under what circumstances this special case can happen and see if there's a way to get rid of it.
Starting from this rule, it should be possible to rewrite this to use at most a couple SQL calls.
The text was updated successfully, but these errors were encountered:
solenoid/solenoid/emails/views.py
Line 25 in 2bc8ac1
I came across this when I was looking at some other things and this all really needs to be rewritten. It's making a ton of unnecessary SQL calls. I'm guessing this surplus of calls probably is what led to the note about closing old connections. There should be no need to close the connection here because this is absolutely happening within context of the normal request/response lifecycle. The request is probably just prone to timing out due to all the SQL calls which may be leading to stale database connections.
I tried to come up with a clear statement of what I believe to be the business rule at play here:
There also appears to be a case in which an email message has been created for an author, but before it has been sent more records get added to it. I think we should further consider under what circumstances this special case can happen and see if there's a way to get rid of it.
Starting from this rule, it should be possible to rewrite this to use at most a couple SQL calls.
The text was updated successfully, but these errors were encountered: