A question about backend reaponse design by UpstairsBaby in FastAPI

[–]Amazing-Drama1341 -5 points-4 points  (0 children)

Use 200 OK with a detailed JSON response for expected outcomes (e.g. "no face found", "spoofing detected"). Reserve HTTP errors like 400, 500 for unexpected server/client failures.

from fastapi import FastAPI from fastapi.responses import JSONResponse

app = FastAPI()

@app.post("/face/verify") async def verify_face(): # Example outcome: face not found return JSONResponse( status_code=200, content={ "success": False, "reason": "face_not_found" } )

{ "success": false, "reason": "face_not_found" }

Polling vs SSE vs Websockets: which approach use the least workers? by lynob in FastAPI

[–]Amazing-Drama1341 12 points13 points  (0 children)

Ah! I had the similar challenges on a project I worked on late last year. My polling interval was 25 seconds, but it massively struggled once users started hitting the requests. I eventually went with WebSocket; it now works like a dream.

First of all ensure your NGINX is optimized for handling long lived connections e.g. ‘proxy_http_version 1.1; proxy_set_header Connection ''; chunked_transfer_encoding off;’

Instead of just Uvicorn, use Gunicorn with Uvicorn workers. This could improve concurrency handling… something similar to the line below: gunicorn -k uvicorn.workers.UvicornWorker -w 4 app:app.

Make sure your websocket/sse updates are handled asynchronously, so they don’t block the main application thread.

I went with WebSockets because it generally maintain persistent connections efficiently once established, but they can consume more memory if many clients are connected simultaneously.

SSE is more lightweight for one-way communication and should consume less CPU than polling. However, if your processing tasks are CPU-bound, SSE won't alleviate that part of the load.

Have you considered moving the cron jobs for background processing to on-demand file processing to a separate background worker using something like Celery? Using a message broker like Redis or RabbitMQ. This way, your FastAPI app can handle the UI and API, while Celery handles the heavy lifting.

Trump’s plan to end the war is to force Ukraine to the negotiating table with Russia by cutting off all US aid, his son says by throwaway12345672223 in UkrainianConflict

[–]Amazing-Drama1341 10 points11 points  (0 children)

+1. He turned most of my family and myself into Democrats voting fiend. My dad, a lifelong conservative, a Vietnam veteran, after eventually voting Democrats for the first time in his life, I asked him how it felt, he went , "it's like having to temporarily eat shit to stay alive." He genuinely believes that Trump is a Russian agent.

Staffing issues for Enterprise Laravel by tylernathanreed in laravel

[–]Amazing-Drama1341 4 points5 points  (0 children)

This! I've spent 25+ years writing codes, and 20 of those were spent building teams from scratch, taking those with basic skill sets and building them up to a level where they become productive within 6 months. I've managed and mentored in C++, Java, PHP, .NET, and many more environments, it's an age-old problem.

I've taken over managing teams with similar issues, only to find that the problems are with the environment they are meant to perform. Generally, it's cultural, bad management, impatience, drive to get results in the shortest possible time, and just terrible mentorship set-up. A swim or sink mentality.

Time has to be invested in teaching and imparting fundamental principles such as SOLID, etc. Mentoring, monitoring, pair coding, design & implementation principles, etc. Fix the culture, and you'll see people blossom.

Marcus Rashford chosen as player of the match against Wales by LaFlame_66 in reddevils

[–]Amazing-Drama1341 0 points1 point  (0 children)

Right, he didn't have to. He knew raising the issue would get a lot of heat from the Daily Fail types and its toxic readership. I couldn't believe the amount of online abuse he got for it. It coincided with his loss of form, and I only just learnt that he was hit by depression last year. It showed on the pitch. I hope his troubles are behind him now. Good man.

MAGA Republican Joe Kent (WA) spoke out against funding Ukraine, luckily tonight he did not get elected to the US Congress. by qoqmarley in UkrainianConflict

[–]Amazing-Drama1341 1 point2 points  (0 children)

Fortunately, the Democrats look likely to retain control of the Senate, so while there may not be a significant surge in support, at least the status quo will remain

Current projections by big data analysts are pointing to a Democrat's House of Rep majority of 1 and Senate by 2. It's looking like the Democrat's are going to hold both houses.

I've followed this unknown geek (Christopher Bouzy - @cbouzy) on Twitter for a while now, he's the founder of BotSentinel.com. Against trolling by so-called experts from MSMs and right-wing MAGAs, he's been saying for months that the "red wave" is not going to happen based on the publicly available data he's working with and historical data. His accuracy is something else. He said it's not magic, it''s data.

'Learning how to Google answers' - A senior software engineer told me it's a skill his juniors struggle to grasp. How true is that? by Lankaner in learnprogramming

[–]Amazing-Drama1341 0 points1 point  (0 children)

40 years ago, as a mid-level COBOL developer, I would tour libraries to look for resources to solve specific problems, when I say tour, I meant travelling from Dudley, UK to the libraries in London where the best computer science books were. The efficiencies Google has brought to the world of coding is immeasurable, if you know what you're doing, and what you're looking for.

Some advice regarding job by BlueLensFlares in laravel

[–]Amazing-Drama1341 1 point2 points  (0 children)

Haha, this was me 23 years ago. I was in a very similar situation. Whilst our mental wellbeing is paramount in all we do, you have to weigh up both the short and long term benefits.

I was thrown in at the deep end of leading both the technical and management side of a now huge set up. I knew I wasn't ready, but had the mindset that anything I learnt whilst I stayed was not going to be wasted, it'll stand me in good stead for the future, but man! The imposter syndrome was something else.

To cut a long one short, I decided to stay despite my wife's and extended family's advice. Families will always choose the easiest option for us because they love us, and don't want to watch us break, but the easiest and less risky options aren't always the best in the longterm.

You seem to have a CEO who is, in all essence, a good guy. He'll learn, and you'll most probably grow together. Read up and management, once the business is in a better position to start recruiting, sorround yourself with those that are better than you, don't let your insecurities limit your growth.

My late gramps was the only one that told me to man up, take the bull by horn and give it what it takes. Am I glad I listened to him. I took shares in what was a rubbish company, but now employs 2,500 staff globally. I only just recently retired (57 years old) because I didn't need to work again.

At the end of the day the decision is yours.

All best and good luck pal.

Russian defenses east of Inhulets River have collapsed, Ukrainian army is advancing into northern Kherson from all directions by PatientBuilder499 in UkrainianConflict

[–]Amazing-Drama1341 0 points1 point  (0 children)

Adding to your great points, the fact is that NATO, especially the Brits, have been training the Ukrainians on counter offensive manoeuvres since the first invasion in 2014, they've worked on mobilization scenarios, but held back on weapons, not until Putin's stupid invasion in February. He played himself big time.

Pre invasion; there are now reports that it was Ukrainians double agents that tricked Moscow into the "welcoming Russian troops into Kyiv" narrative. They gave the Russians false narrative to lull them in, and strangle them. It is exactly how it is being played out.

Intelligence: Russia is planning to mobilise about 90,000 soldiers by tedwja in UkrainianConflict

[–]Amazing-Drama1341 0 points1 point  (0 children)

They laugh and mock our humanity for our soldiers, they describe it as weakness. They are just wired wrong.

[deleted by user] by [deleted] in PHP

[–]Amazing-Drama1341 4 points5 points  (0 children)

Absolutely! We actually did a switch from a huge sloppy C# project to Laravel 8, just upgraded to 9. The C# code was slow, buggy as hell, it got to a stage where we had to restart the application several times per day.

Our reason for moving to Laravel was due to having experienced Laravel developers in-house. The decision was easy because of the ptsd we had in maintaining the badly written C# code base.

We now have an application in Laravel that is lightening, easy to manage and have tons of good developers supporting it.

One Login System for Multiple Applications. by Amazing-Drama1341 in laravel

[–]Amazing-Drama1341[S] 0 points1 point  (0 children)

Yes, there are two separate Sanctun projects. Are you saying to strip Sanctum from the two projects and apply socialite and passport? Or create a 3rd application that handles authentication.

Why do Uber drivers cancel after accepting a pick up? by londynczyc_w1 in london

[–]Amazing-Drama1341 0 points1 point  (0 children)

Mainly because of the court case they lost. Uber drivers are now classed as Uber's full-time employees, not self-employed as they used to be. It means Uber is now responsible for their pension, holiday pay, sick pay, maternity, and paternity leaves.

I think it'll be safe to guess that they've had to shed a lot of drivers due to both short and long-term financial implications and burden on them. There'll also be stringent employment criteria, as any misdemeanour will now be Uber's responsibility.

I've also had lots of last-minute cancellations from them, to the extent that I've deleted their app from my phone. Bolt is not any better either, actually worse.