refactor(DetailedStopGroup): replace async_stream#3310
Conversation
joshlarson
left a comment
There was a problem hiding this comment.
I'm on the fence about this change, tbh. The stations page does in fact load stations for every non-bus route before rendering (even if you're just looking at the subway stations tab), which means that now we're making 29 @stops_repo.by_route/2 calls in sequence, instead of in parallel.
In practice, it's probably okay - I tested it out and while it does seem to increase page load time when the cache is empty, that's likely to be a once-or-twice-per-day sort of deal.
I feel like it would reasonably be equally correct to either have these async_start calls handle timeouts more gracefully (retry?) and/or to have timeouts bubble up and cause the whole page to 500.
Don't create possible timeouts, just get everything anyway
This reverts commit aabe250.
065679c to
b8008f0
Compare
|
✌🏼 Take two: restore the
Behavior stays the same as before: a task timeout will ultimately make the page return a 500. But I hope to make that happen less frequently by avoiding these functions from timing out. |
Scope
MBTA-DOTCOM-JV
In the continued vein of, we unearth old but recurring Sentry issues from the archive...
Implementation
This message appears when
Task.async_streamdoesn't specify anon_timeoutaction - the default behavior is the task exits!In this case I think it's better if we don't create possible timeouts: just get everything anyway without async calls, since we'll always want this page (
/stops) to list all the stops.I think the code had likely been structured this way because fetching and processing all the stops can be kinda slow. So this updated code leverages
StreamoverEnumin a few spots for some hopeful performance improvements. The flame charts are still massive here, but I did see this page go from producing an SVG of 5.2MB to one that's 3.4MB...