>But Flask does not give control of what happens when the client suddenly closes the connection.
It is so annoying that they don't give you a way to do this. I built an LLM inference API but am still working on how to cancel an inference job if a client cancels. I really don't want to rewrite my entire server in Twisted so I'll probably end up just building the HTTP responses like you did.
I believe the WSGI spec is a bit unclear on this but some WSGI servers can give back control to the app when the connection gets closed. I use Flask and Waitress for long-lived server side events and my app is notified when the client closes the connection before the end of the stream of events.
I have a theory as to why pedestrian deaths have risen significantly above pre-pandemic levels, and it might be related to a side effect of COVID-19 known as "brain fog."
Many people who have recovered from COVID-19 have reported experiencing cognitive issues, such as difficulty concentrating, memory problems, and mental fatigue. This condition, often referred to as "brain fog," can persist for weeks or even months after the initial infection.
My hypothesis is that this brain fog may be impacting pedestrians' and driver's ability to stay alert and make quick, safe decisions while navigating streets and crosswalks. If a substantial portion of the population is experiencing these cognitive challenges, it could lead to more accidents involving pedestrians.
A lifestyle that includes brain-fog avoiding habits and activities, notably socialization, family and friends, and so on -- anything that provides outsize stimulus to the brain.
Generally, I wager the main cause of the brain-fog (as well as sensory issues) in most who received it from COVID is due to the lock-downs, and coinciding loss of activities that normally would keep the hypothalamus functioning properly. Instead these "creative" activities are no longer present to create and reinforce "good" neural pathways, so they start becoming pruned, so the hypothalamus shrinks, and then come the cascading effects such as reduced neuroplasticity, reduced creativity, reduced "zest" for life -- but these are just the psychological, I've ignored the physical changes that can manifest due to dysregulation in the HPTA axis.
I myself have been able to reverse a lot of this (from COVID, but also from being dealt a bad hand in life) with various experimental peptides that interact with BDNF.
A striking realization I had was that this "brain-fog" can be seen in a lot of people and its causes have become obvious to me. A notable example is senior citizens (60+ y.o.) that are "stuck in their ways" and have various forms of dementia. The easiest trick to reverse such "age-dependent reduction in neurological function" is to take steps toward integrating them into social groups with those who are "mentally young." I have tried this with both my European-born mother and my American-born father. The former succeeded at 73 in reversing age-related mental deficits and physical maladies, but the latter did not.
I posit that this is a cultural issue. European socialization is much more varied in conversation, emotion, expression, subject, and so on. While American socialization is much less in these respects. The other issue is that those socialized in the American way are more likely to be unable to "adapt" to the European way, and so will fail because they do not have the skills necessary to integrate, due to a life of having American socialization engraved in their neural pathways.
Generally, it's my opinion that a large bulk of America's mental, physical, and political maladies are greatly amplified by this lack of novel and consistent stimulus. That is to say nothing about having to commute alone daily (stress and routine boredom), cities that do not cater to exploration and low-cost novelties, a culture of individualism that precludes having deep bonds with others, anti-intellectualism, an over-bearing work culture and cautioned work-place atmosphere, and so on that reduce creativity, reduce neuroplasticity, reduce a zest for life, and create a society filled with effectively robots who have had their neural pathways reinforced so heavily into a very narrow "model of living and being" that escape is simply impossible without sustained exogenous influence.
With that, I have other things to do! -- because I do not foresee any interesting and novel conversation to serendipitously irrupt from my thoughts.
Maybe, but seems more likely that our over dependence on phones and touchscreens in cars. People have more things to distract them rather than focusing on driving.
Pedestrian deaths have been rising long before the pandemic. The lowest point was in 2010. The rise in pedestrian deaths post-2020 follows the same trend as pre-2020 in the US.
Most other developed countries, all of which had COVID-19, have managed to decrease pedestrian deaths in recent years. Just not the US.