Flutter - Getx issue with rest API requests - flutter

I have a problem with my project it doesn't happen a lot but it's very annoying, When a user call request for example (x) it could happen 1 time out of 10 and I don't know why this could happen and I caught the error it returns connection closed before full header was received.
I attached an image that illustrates my app cycle between the view - controller - rest API request.
Anyone can help me, please.
My Architecture

Related

How to handle responses which take more then 5 seconds

For the google actions that i am developing some responses are complex and take more than 5 seconds to process.
Could someone please suggest how can this be handled.
Generally i would consider using loading dots and then replacing that message with the result but i don't see any Google Action API for it. Also is there any endpoint to which we could async send back the result later ?
Thanks
PS: I am using Conversation API.
We don't really have a good way to handle this right now, but we have a couple of approaches that sorta work based on your needs.
Notifications are currently available for the Assistant on smartphones, and they're coming for speakers. In some cases, it might make sense to say that you're working on the problem and you'll send a notification when you have it, and then resume the conversation from the notification.
Another approach is to use the Media Response to play a bit of "hold music". At the end of the segment of music, your webhook will get a notice that the music has completed. If you have the result available, you can report it at that time.

Chrome Dev Tools - Filter out xhrs from background worker

I'm trying to troubleshoot some UI issues that I've been having that I think are tied to XHR requests that I'm making on the main thread. But when I look at the network tab, I see a ton of my background worker requests and it becomes really hard to see exactly which request came from where.
Is there any way to filter the network request so that I can see if the request was initiated from a background worker (and if so, which one) or the main thread?
I added the "initiator" column to my network tab, but it just says "Other".
Thanks in advance for any help

Facebook graph API suddenly going very slow

I'm not really sure what's going on, but today I've noticed that the facebook api is working extremely slow for me.
At first I though it was a bug in my code, but I tried the Graph API Explorer, and even that's causing timeout errors half the time (just using /me):
Failed to load resource: the server responded with a status of 504 (Server timeout)
I don't think its my internet connection, since everything else seems to be working quickly, and http://speedtest.net is giving me good results.
Is my problem somehow fixable or is this just some sort of freak occurance?
Has this happened for anyone else?
Do I need to consider the case that it will take exceedingly long in my application to recieve a response?
I currently have a registration page that waits for a FB.api response (with a spinner gif) before displaying the form. I could use a timeout to wait a few seconds and show it if the api doesn't respond, but I'd really rather not have to use this same sort of logic in every api call that my application depends on...
EDIT: its spontaneously fixed itself now. still no clue what happened.
You can check facebook api live status with this URL
https://developers.facebook.com/live_status
today at 11:13pm: API issues We're currently experiencing a problem
that may result in high API latency and timeouts. We are working on a
fix now.

How to use a WF DelayActivity in an ASP.Net web based workflow

I have a web application that I am adding workflow functionality to using Windows Workflow Foundation. I have based my solution around K. Scott Allen's Orders Workflow example on OdeToCode. At the start I didn't realise the significance of the caveat "if you use Delay activities with and configure active timers for the manual scheduling service, these events will happen on a background thread that is not associated with an HTTP request". I now need to use Delay activities and it doesn't work as is with his solution architecture. Has anyone come across this and found a good solution to this? The example is linked to from a lot of places but I haven't seen anyone else come across this issue and it seems like a bit of a show stopper to me.
Edit: The problem is that the results from the workflow are returned to the the web application via HttpContext. I am using the ManualWorkflowSchedulerService with the useActiveTimers and this works fine for most situations because workflow events are fired from the web app and HttpContext still exists when the workflow results are returned and the web app can continue processing. When a delay activity is used processing happens on a background thread and when it tries to return results to the web app, there is no valid HttpContext (because there has been no Http Request), so further processing fails. That is, the webapp is trying to process the workflow results but there has been no http request.
I think I need to do all post Delay activity processing within the workflow rather than handing off to the web app.
Cheers.
You didn't describe the problem you are having. But maybe this is of some help.
You can use the ManualWorkflowSchedulerService with the useActiveTimers and the workflow will continue on another thread. Normally this is fine because your HTTP request has already finished and it doesn't really matter.
If however you need full control the workflow runtime will let you get a handle on all loaded workflows using the GetLoadedWorkflows() function. This will return acollection of WorkflowInstance objects. usign these you can can call the GetWorkflowNextTimerExpiration() to check which is expired. If one is you can manually resume it. In this case you want to use the ManualWorkflowSchedulerService with the useActiveTimers=false so you can control the last thread as well. However in most cases using useActiveTimers=true works perfectly well.

Mac OSX/iPhone error handling in the App Delegate?

I'm curious, how do most of you folks handle errors such as HTTP Forbidden or 5xx type requests from a server? Or say an exception is thrown in one of your UIViewControllers? Do you typically bubble up the error to the App Delegate and handle generic "window" level errors at that point? Do you couple errors directly into the UIViewController? What if you have several UIViewController's which all speak to a common NSURLConnection wrapper, and a connection fails for some HTTP 4xx or HTTP 5xx similar error. Will you typically bubble up the error to App Delegate so it can present a UIAlertView from that portion of the application?
Just wondering what solution you're using for your Mac OSX/iPhone error handling techniques.
Thanks a bunch.
Your current view controller should be responsible for dispatching any error message and dealing with the result.
The last part is the key here. If you encounter an HTTP error and pass the message up to your app delegate with a "retry" option the response then needs to go all the way back down to the controller. This all gets a bit yucky.
Now you may want to create a common class/view in your app that can deal with all the errors you're likely to encounter, but this should still be presented (in a modal fashion) by the controller that encounters the error and it's this controller that should receive delegated responses.
The controllers may or may not need to know there has been an error in order to properly recover from a network error, but for iPhone development I have found it useful to have a core communications class that understands all the communication going into and out of the system, and when it detects failures issues an alert directly. That way you can prevent an overload of failure notices if a user switches tabs or otherwise moves about the application, and just generate one message so that the user can understand why screens are not updating.