Tumgik
#runhome
codehunter · 1 year
Text
Flask+gevent - SSE times out with nginx+uwsgi
I'm writing a webapp, based on Flask, gevent and Redis, which makes use of Server Sent Events.
I've gone through several questions on StackOverflow, and extensive search on google, but did not find any suitable answer that works for me, so here I am asking for the community help.
The problem is with the production stack, nginx+uwsgi: the browser receives updates regularly (and refreshes as expected) for about 30 seconds. After that the connection times out and the browser does not receive any update anymore, until the page is reloaded manually.
Since the whole thing works perfectly on localhost, with standard flask development server (connection alive after 30 minutes of idle), I'm pretty sure that the issue is on the uwsgi/nginx config. I've tried all the nginx/uwsgi settings I could think of but nothing, it keeps timing out after some seconds.
Does anybody have a clue ?
Here some code and configs.
nginx relevant production settings:
location / {include uwsgi_params;uwsgi_pass unix:/tmp/myapp.sock;uwsgi_param UWSGI_PYHOME /srv/www/myapp/venv;uwsgi_param UWSGI_CHDIR /srv/www/myapp;uwsgi_param UWSGI_MODULE run;uwsgi_param UWSGI_CALLABLE app;uwsgi_buffering off;proxy_set_header Connection '';proxy_http_version 1.1;chunked_transfer_encoding off;proxy_cache off;}
uwsgi production settings
[uwsgi]base = /srv/www/myappapp = runhome = %(base)/venvpythonpath = %(base)socket = /tmp/%n.sockgevent = 100module = %(app)callable = applogto = /srv/www/myapp-logs/uwsgi_%n.log
this is the javascript that the template executes to subscribe to the channel (for the time being, the template just refreshes the whole page when the server pushes some data)
<script type="text/javascript">var eventOutputContainer = document.getElementById("event");var evtSrc = new EventSource("/movers/monitor");evtSrc.onmessage = function(e) { console.log(e.data); location.reload(); //eventOutputContainer.innerHTML = e.data;};</script>
This is the code I use to return the streamed data
from myapp import redislistfrom flask import Response, Blueprint, stream_with_contextmovers = Blueprint('movers', __name__, url_prefix='/movers')r = redislist['r']@movers.route("/monitor")def stream_movers(): def gen(): pubsub = r.pubsub() pubsub.subscribe('movers-real-time') for event in pubsub.listen(): if event['type'] == 'message': yield 'retry: 10000\n\ndata: %s\n\n' % event['data'] return Response(stream_with_context(gen()), direct_passthrough=True, mimetype="text/event-stream")
and finally the app is executed like this (DEBUG is True on localhost)
from myapp import appfrom gevent.wsgi import WSGIServerif __name__ == '__main__': DEBUG = True if app.config['DEBUG'] else False if DEBUG: app.run(debug=DEBUG, threaded=True) app.debug = True server = WSGIServer(("", 5000), app) server.serve_forever() else: server = WSGIServer("", app) server.serve_forever()
https://codehunter.cc/a/flask/flask-gevent-sse-times-out-with-nginx-uwsgi
0 notes
therunhome · 5 years
Photo
Tumblr media
Hope you had a great Saturday and you made time for some exploring! • #saturday #explore #igtravel #exploremore #lighthouse #getoutside #runner #running #runners #run #wander #runhome #therunhome (at Baltimore Inner Harbor - Light Street) https://www.instagram.com/p/BvpieDZhZ6V/?utm_source=ig_tumblr_share&igshid=jjowsl2ota12
1 note · View note
blinkiing-blog · 7 years
Note
"Oh Come On You Look Cute."
4. A sexy nurse’s outfit
“ Yer kiddin’ right? Angela would probably kill me if she saw me in it! Then revive me. Just to kill me again! Is it actually somethin’ you like love? ” Normally Lena wouldn’t mind something like this. Especially when just with Emily, but this was just impractical.
“ I feel like I’m gonna be starrin’ in some really bad porno… ”
1 note · View note
Text
@runhome continued from X
The musician happily returned the hug to her. He loved meeting his friends’ friends, especially Emily she was always a ray of sunshine and incredibly nice to everyone.
“Thanks, I’ve been doing well. We should take more time out of our days to visit you, you always brighten up the party!”
1 note · View note
okaybutlikeimagine · 5 years
Note
Susan scolding Billy for something and maybe says something in the heat of the moment like ”this is why your dad treat you like this” and Billy says that Neil is not his father. But Billy also feels that its his fault he blames himself for getting beaten. And he runhome to hop and collapse in his arm and stays there for a long time as hop comforts him
Ohmydearme okay i dunno if this is what you were thinking of but i got real angsty thinking about this and made myself wanna cry bc like??
{TW: implied homophobia, implied abuse}
Let’s collectively think about Billy at the grocery store (bc i don’t think i’ll ever get sick of thinking of Billy doing little mundane tasks like grocery shopping) to pick up some random things like milk and a box of pasta or something, when he turns down the dairy aisle and locks eyes w/ a red haired woman he hasn’t seen in months standing at the other end of the walkway.
Susan.
And Billy leaves the aisle immediately bc he’s not about to deal w/ this shit. He doesn’t want to see her and he doesn’t want to handle it. But she fucking follows him, no matter where he’s going she’s peering around corners and looking at him w/ her tired eyes and he’s just gonna leave at this point when she finally bumps into him.
“Oh! Billy! What a surprise. I’m actually glad to run into you.” She says, clearly nervous as she fixes her cardigan absent-mindedly.
Bullshit. You fucking forced this.
“Sorry, can’t say the same.” Billy says with that charming smirk he gives to all of the middle aged mothers in Hawkins, except this one is laced with poison and is aimed at someone who is most definitely immune to it.
“Come on now, Billy.” Susan’s eyebrows are furrowed, her eyes disapproving but still semi-fearful. Her eyes are always fearful. “I just wanted to talk to you about something.”
And Billy is standing there basically stranded with a row of cheeses on one side and ice cream on the other and this woman in front of him so he just sits in his hip and looks at her expectantly.
She clears her throat.
“I just… wanted to talk to you. Because… well… there’s no real easy way to say this, is there?”
She seems nervous. For a second Billy thinks this is going to turn into something about Neil. A million reasons why this woman would want to talk to him run through his head all at once. They all scare him, until he comes to find this isn’t about anything he was thinking of.
“It’s just, my friends have been telling me that they’ve been… seeing you with a boy. Pretty frequently. Sometimes they say you get rather close to him and… well they’re starting to question my parenting because they know I’ve been your mother for-”
“You’re not my mother.” Billy grinds out and it seems to take Susan aback.
“I- I… well yes, of course not. Of course not.” Her voice is quiet as she says it.
She looks at Billy with that same hint of fear in her eyes. Billy’s stare is stone. Susan continues.
“I just had to tell you that it’s all getting so… well so embarrassing, honestly.”
“Embarrassing?” Billy’s arms are crossed, jaw tight, eyes fixed.
“Yes. You’ve put me in an incredibly embarrassing situation. And I can only think of how embarrassing it must be for Maxine, too.”
Billy’s seeing more red than just Susan’s hair.
“Well Susan, I have good news for you. You’re out of my life now and what I do with the local boys is none of your fucking concern.” He’s smiling something poisonous and harsh that Susan would normally shrink at, and she does for a second, before she puffs herself up.
“That’s absolutely no way for you to speak to me, young man.”
Billy’s going to throw fists at the mozzarella balls next to him. He takes a heavy breath. Susan looks like she’s about to step on a real high fucking horse.
“I just had to tell you that people are starting to talk. They say you... you might be… that thing that your father always said you were.” She’s shaking her head, looking anywhere but Billy for a second. “I’m just showing concern for you, is all. I don’t understand this hostility-”
“Well I can explain it to you. It’s because this is none of your fucking concern. I left for a goddamn reason.”
“Billy, really-”
But Billy isn’t done. He takes a step forward, looking down on her with a stare to melt ice, his gaze completely blinded by the warm rage clouding his mind because he’s fucking pissed and his whole body is shaking and his hands are slowly morphing fists and then he’s growling:
“And it wasn’t to listen to shitty warnings about what your hive-mind, hope-to-be-divorcee friends think of me. I don’t fucking care, so kindly stop talking to me and go grab your low fat cream cheese and your copy of Cosmo and cry yourself to sleep about how your husband doesn’t touch you enough.”
His mind is completely fogged up and racing and it’s not until he’s done talking that he starts to see again. Starts to cool down enough to even register Susan’s face in front of him and it’s one of pure submissive fear. Something he thinks he’s felt before, just by looking at it. Susan has always had fear in her eyes, has never stood up for herself, and Billy is so sure this is going to be another instance bc nothing in his experience has ever proved otherwise. But suddenly her gaze hardens over and she starts breathing harder and she’s huffing like a fucking chain smoker before she says, with venom in her gaze:
“I used to question it, but really it’s no wonder that your father treated you the way he did.”
And in a split-second, Billy’s world freezes over. He’s been stuck with shot of ice. He’s completely frozen solid as he watches Susan’s face once again slip into that fearful submission. He thinks maybe she’s going to be as meek and timid as she always is. It was just a blip and she’s about to start apologizing profusely, like she always does when she makes somebody upset.
But no.
No, she hardens up. She straightens her back. She looks Billy dead in the eye. This is the rock she’s chosen to stand on. This is the comment she’s decided to stick up for. This is the side she’s chosen. It’s this. And it’s against Billy. It’s saying Billy deserved everything she’s seen Neil do to him.
It’s getting hard to see again, but this time it’s blurry instead of red.
“That man is not my fucking father.” is all Billy can muster up.
They stare at each other for a good few seconds before Susan looks to the people who are slowing down near them. Ever concerned about her public image.
“I think you should go now.” She says like she fucking owns the store, like he’s not fucking welcome in this public grocery store.
He wants to fight. Wants to scream and kick and punch and just break something. But he turns on his heels and he leaves with what feels like a storm of emotions trailing him out and he drives back home in a rush of blurry red that honestly inhibits his driving more than alcohol does most times and he’s walking into the cabin and slamming the door behind him and Hop is standing in the kitchen with a mug of something and confused concern in his eyes and a question of: “Billy? What’s wrong?” on his lips and Billy is falling apart.
Unraveling and spiralling and falling falling falling because he sees Neil every time he closes his eyes. He sees that red face and that mouth full of spit and those eyes full of fire at every little thing and he hears himself. Hears what he just said to Susan not 10 minutes ago. Those horrible things that he knows were horrible but he still said them because he’s just looking for attention, just isn’t disciplined enough, needs to learn respect and responsibility and the consequences to his actions.
His vision is too blurry to see anything but angry and red and puffing Neil, looming above him and knocking him down and his knees can’t physically hold him anymore because he’s unraveling, thread by thread unraveling so fast that he falls and lands on something hard but soft, surrounding his torso because he didn’t fall down, he’s fallen into something and it’s rumbling something low and quiet and-
“Billy? Billy, let’s sit down, okay?”
And once he’s seated he realizes it’s Hop. It’s Jim. and the rage is inside of him because fuck he can’t fucking get rid of it, some days it feels like it just fucking lives there and he’s gathering the fabric of Jim’s shirt up in his fists hard and he’s burrowing his face into Jim’s chest and he’s just sobbing. Everything inside of him bubbling out like a soda bottle and the world is black yet blurry and red with that spit filled mouth of anger and he just feels so weak. Weak from crying, weak for crying, weak in his mind and his body and he just stays there. They stay there. For what feels like too long to be real, they stay there.
And Hop holds Billy until he feels the boy’s shoulders relax. Until the grip on his shirt is free. Until he stops hearing the mumbled ramblings of I deserved it I deserved it I deserved it being spoken against his chest.
He asks Billy if he wants to talk about it because he’s learning about this stuff as he goes and he knows sometimes Billy can’t talk. Billy shakes his head no.
They listen to a record and drink some hot chocolate and Billy stops shaking about half an hour before El comes home from hanging out with her friends. She immediately notices his red eyes and his runny nose and asks Billy if he wants to borrow one of her stuffed animals as a sleep buddy. He thanks her and lets her hug him before he heads to bed. Sends Hop a quiet “goodnight” and the smallest smile imaginable before he climbs under his covers. But he doesn’t shake through the night and actually gets some sleep and that’s enough to feel like an accomplishment right now.
128 notes · View notes
decaffienated · 4 years
Video
He just wanted to go for a ride @vikkidonadio - he worked sooo hard to get there and we put him back in the starting line 😂 Poor Gary🐌 #runhome #littleadrenalinejunkie #snaillivesmatter https://www.instagram.com/p/B6YWmv4FNQS/?igshid=ow2kevohvro
0 notes
Audio
0 notes
nutritionmartin · 7 years
Photo
Tumblr media
Now that was tough Run to the gym Dumbell workout Run home Now time to chill #runtothegym #dumbellworkout #dumbells #runhappy #runhome #hiitworkout #hiit #gym #fitness #sundaychill
0 notes
grobb66-blog · 7 years
Photo
Tumblr media
#embracethesuck #runhome from work. (at The Phoenix-Fidelis Foundation)
0 notes
amisgv · 7 years
Photo
Tumblr media
Barrels, first one, he's getting better every time.....So proud of this big nugget! 🐴💖🐴#polesponiespinups #blackbotticelli #botticelli #newchapterinmylife #happygirls #horseshow #runhome #downandback #thoroughbreds #racehorses #speeddemon #horsefunshow #healeysranch #horsearena #horsearenas #myhorseisthebest #myhorseisamazing #myhorseisbeautiful #happyhorse #barrelshow #haventpostedinawhile #haventposted #dirtarena #summerday #summer2017 (at Healey's Outback Ranch)
0 notes
jwrichardson · 7 years
Photo
Tumblr media
Clouds on the horizon. #signsandportents #aroundthebend #runhome (at Greenville, Illinois)
0 notes
charleshardaker · 7 years
Photo
Tumblr media
Very wet Monday night run home through the park! #project365 #runhome #running #beckenham #raining (at Beckenham Place Park)
0 notes
Photo
Tumblr media
Running is one of the most powerful ways to embrace your own environment, seeing things from your own unique perspective and sharing it as only you can. #morningrun #runhome #mybackyard #rundenver #featonthestreet
0 notes
makkahn28 · 4 years
Photo
Tumblr media
Oh my GOD, Look at the Size of that Goddamn F'N thing Will that hurt? No, BUT in SSBB, Fock the Bat, That Big Thing will definitely Hurt and Score a RunHome https://www.instagram.com/p/CFyf7hAgJdm/?igshid=1grb1wadtwzx5
0 notes
jobzz · 5 years
Photo
Tumblr media
[ Don’t Runhome ] #sketchbook #pilot #designer #draw #sketch #blackbook #ink #black #love #artist #scribble #bat #baseball # #scarecrow #mexicanartist #inktober #drawing #doodle #love #hobby #lines #pen #sakura #brush#mexican #mexico #dibujo #homerun https://www.instagram.com/p/Bzf6v31HCmw/?igshid=6rpdtsyurovq
0 notes
runifico · 5 years
Photo
Tumblr media
Run the city! Für alle die sich schon auf den Zieleinlauf beim @berlinmarathon freuen wollen oder das langfristige Ziel im Auge behalten wollen - ab hier sind es noch gute 200 Meter pure Freude! Go for it! #runhome #homerun #sightrunning #berlinmarathon #berlinmarathon2019 #training #ditisberlin #liebedeinestadt #runner #running #marathon #longrun #hintenkacktdieente #brandenburggate #brandenburgertor #tourism #berlin #history #crossing #cityrun #quadriga https://ift.tt/2NZHLJH
0 notes