Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 10 months ago.
Improve this question
I try to fetch some data from api and store the data in a userdefault, then in another func to use the value in the userdefault. But sometimes when I try to get the value in the userdefault, it has not been fetched from api because of the poor internet, so how can I make sure I can get the data before I execute the second func.
Or do you have any solutions?
Thank you guys
There can always be conditions where you can fail a fetch. When you are executing your function that uses the data you were fetching you can first make sure there is any data at all, before manipulating it.
For slow internet specifically, you can check "retries" and retry mechanisms: example
One more thing, UserDefaults shouldn't be used for storing large data, it's typically used for storing some user preferences like colors, fonts, etc. (It's not encrypted - unsafe)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
does anybody know how much space is used, whenever a google cloud function is invoked. The free spark plan says 125k/month is allowed. But how much space is used just for a simple function call expecting e.g. two parameters, adding them together and send back the result as the response.
How many times could this function be called in a month to reach the limit of 125k?
The limit you're referring to isn't called "space". It's the number of free invocations allowed per month, documented in the pricing page. Each time you run a function, it counts as 1 invocation. It is not any more complicated than that.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So I was debugging the google search using chrome dev tools and I found out that each time I modify the contents of the search bar, it makes a network call. That itself was baffling for me because this means each search generates around 10 or more server calls for google! Even more surprising is the fact that even then google manages to return suggestions so fast. How do they do it?
One more doubt would be how they handle concurrent ajax calls? (assuming they are ajax calls ofcourse). Like if my search does 10 ajax calls to the server and the latest ajax call returns results faster than the second last ajax call then in that case the response from the second last ajax call would be shown on the UI instead of the latest call right?
They have servers that can upload/download and retrieve upwards of 10 GB/s so that is why!
Happy Coding!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I've webhook, which is hitting with multiple entries on my function. Sometime when there are 10 to 15 request, the database insert and update query is missing.
There could be many solutions like :-
Add Queuing system, on api request add job in queue response back & let queue add to database.
Use what databases do, they add to file and then from file they push to database.
There could be many other solutions and also maybe above 2 may not work for you perfectly, which solution to choose depends upon what you are doing
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Good day.
I was faced with the task, can not find the answers on the internet, can anyone be able to help.
I need to send a request to the service. This request must be sent no more than 1 second once per hour. From the answer to the query to extract part of the data. When you receive or availability of this information, it should be added to the text box. Data should be stored and re-used after restarting the application.
To connect to the service, I use Alamofire. Help please, whether there is in this library any function to set the time limit, I request? And how to save the data? Save the new json file locally, or the data stored in an array, or use the database?
Thank you for your help.
I don't have an idea of setting a time limit, but you can explore the NSTimer function to check for that and if it is just a string that you want to store, you only need to use NSUserDefaults for that. It stores your data as a property list and you can access it from anywhere in the app at anytime.
Here's a link to help you setup NSUserDefaults.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am looking to achieve something like this:
To have one input json request, which will encapsulate what to do than:
split that input into 3 or more sub-requests depending on json, like put in database
an agent will wake up since he is processing one part of that request, like putting data to some server
another agent will woke up since the request is for him too, he will like upload data to some other server
meanwhile another request could do state information about request whats part did executed and finished
Is Django + Celery good for this ?
Main goal is to with one request serve parts independently, so like when processing request when waiting for the server in one part of request will not ommiting other part of request which will be processed without any lag.
If your json contains all sub-requests and can be handled asynchronously, seems like this is a job for RxJava which can handle event based programs using observable sequences. Best to read the docs first to see if they fit your use case.