I have a network timeout set for my Branch initialization but so many times the initialization ends up taking 10 times longer than it should. I know this because my app is supposed to be on the Splash screen only as long as the initialization process because of deep-linking. How do I make it faster? Or is there a better way to handle deeplinking?
The Branch initialization process involves sending a network request and then waiting for a response, so this is always going to take some time - normally the response time should be 2-3 seconds with a decent internet connection.
I would suggest starting Branch's initSession as quickly as possible before any other code in the onStart() method of your Splash Activity and you should be able to reduce the time the splash page displays.
Also, by default, Branch will delay the install call (only the install and not any future opens/reinstalls) only for up to 1.5 seconds. We delay the install call in order to capture the install referrer string passed through Google Play, which increases attribution and deferred deep linking accuracy. We do not delay any other call, and the install call only occurs the first time a user opens your app.
If we receive the referrer string before 1.5 seconds, we will immediately fire the call, meaning this delay is up to 1.5 seconds, but not guaranteed to take that long.
If you’d like to optimize the first install call, simply paste the following code in your Application class, and we will not delay the first install call.
public final class CustomApplicationClass {
#Override
public void onCreate() {
super.onCreate();
// initialize the Branch object
Branch.setPlayStoreReferrerCheckTimeout(0);
Branch.getAutoInstance(this);
}
}
Related
I have a serious problem, is that I can not launch any query on clicking on some link in my website until the first request is finished:
I have a musical website in which I generate waveform on click on the track, the problem is that generating the waveform take some sometime (about 12 seconds) to be finished, so if I click on another track it will not start untill the generation (the call to the webservice) is not yet finished.
I have seen in FRONT calls but the problem seems to be in backend, because even in the logs of apache, it says that the first query was called at x time, when it finishes apache write down in the log the second call.
The strange thing is that the time of the second call written by apache is the x + some micro seconds, as the apache also was blocked waiting for the first request also to be finished.
Please help me.
BTW : the website is secured by a password so I must have contact with someone to see the problem
Ask me what ever you want for more details.
Kind regards.
we are facing a problem.
we have background requests that are downloading files constantly (up to 5MB each file). meanwhile, we have a UI that most navigations require REST calls.
we limited the number of background downloads so it won't suffocate the operationQueue that RESTkit uses.
when several files are downloaded in background, we see the network usage with 1->2 MB (which is understandable).
The problem is: the user navigates through the app, and each navigation calls a quick REST call that should return very little data. but because of the background downloads, the UI call is taking forever (~10 seconds).
Priority did not help, i saw that the UI call i make instantly is handled by the operation queue (because we limited the downloads limit and the NSOperationQueue had more space to fulfill other requests.
when we limited the concurrent REST download calls to 5 - the REST calls from the UI took 10 seconds.
when we limited the concurrent REST download calls to 2 - everything worked fine.
the issue here is that because we let only 2 downloads occur in the background - the whole background operation of downloading files will take forever.
the best scenario would be that every UI call would be considered as most important network-wise and even pause the background operations and let only the UI call to be handled - then resume the background operation - but i'm not sure it's possible.
any other idea to address this issue?
You could use 2 RKObjectManagers so that you have 2 separate queues, then use one for 'UI' and the other for 'background'. On top of that you can set the concurrent limits for each queue differently and you could suspend the background queue. Note that suspending the queue doesn't mean already running operations are paused, it just stops new operations from being started.
By doing this you can gain some control, but better options really are to limit the data flow, particularly when running on a mobile data network, and to inform the user what is happening so they can accept the situation or pause it till later.
If we fire multiple adapter call with the gap of 2 -3 sec then how to to stop first call which is running in background ?
Lets say :
I am calling A-Adapter which gives some data after success but at the same time with a gap of 2-3 second if i call B-Adapter which gives some small data within millisecond.
But still the first adapter call is taking time and respond back after 4 second or suppose timed out. Now we are getting success or failure of A-Adapter after B-Adapter success.
Now My doubt is
Can we stop or unsubscribe first adapter call at some point of time whenever required ?
Is there anything in worklight for doing this ?
Issue which we are facing right now is major issue, given below.
Lets say :
I am calling login adapter which gives login success or failure and it is taking some time let say 5 minutes. So what i did i close the app and launched the application again.
I again clicked on login and i am getting successful login and now i am inside the app and doing some work. Now at this point of time , I am getting failure response of login adapter which was taking time.
The answer to your direct question is, no, there is no API that will let you terminate an adapter procedure invocation that is in progress, prior to when it finishes on it's own. Once an adapter procedure is invoked, it must either succeed, fail, or time out.
Where you discuss the possibility of A-adapter finishing after B-adapter, I could not tell if you just intended that as an observation regarding a situation that could possibly occur, or if you see it as a problem or a bug - if the latter, you should understand that since adapter procedure invocations are completely asynchronous, there is no guarantee that adapter procedures will finish in the order they are invoked, and there is not intended to be any such guarantee.
In order to handle the issue you have described, what I would suggest would be to use an invocationContext to make sure that, when your success or failure callback fires, that this corresponds to an adapter procedure invocation that you are expecting a response for, and to ignore the result if it does not. Fore more information, see the section of the Worklight Information Center that describes the options Object.
If the usual, "normal" response time of the adapter procedure is small, you could also try to mitigate this issue by setting the procedure invocation timeout to a small amount of time. So, for instance, if an adapter procedure normally completes within about 4 seconds, maybe set the timeout to 15 seconds - assuming that, if the adapter procedure hasn't finished after that amount of time, something is wrong (maybe the back-end system you're retrieving data from has hung or crashed, or something like that) and it's just going to eventually fail anyway, so just let it return a timeout failure and give up. That way, you don't need to worry about what happens when it eventually fails some minutes later... There was another StackOverflow question asked in the past, where it was explained how to change this timeout.
I'm using Selenium WebDriver to get some content from a site that dynamically loads it using Ajax. I created a custom Wait class to check for a condition on the page to make sure that the page has loaded before continuing. I used FluentWait to set the polling interval to 2 and timeout to 10. However, I noticed that it checks for the first time at time increment 0, then waits 2 seconds if the condition was false, then checks again, etc.
Since the page takes some time to load, it always is false at the first check, but usually is true at the second. Is there any way to make Wait wait the 2 seconds before checking for the first time? I.e. check at times 2,4,and 6, if necessary, rather than at 0,2,4,and 6?
Thanks,
bsg
EDIT
I've been asked to mention why I want this behavior - after all, I'm using the Wait the way it's meant to be used. The benefit I get from it returning true the first time is the following: WebDriver apparently opens a new socket every time it issues a command to the browser. For whatever reason, these sockets don't always get closed after the call executes. When executing a large number of calls in a short time (for instance, when repeatedly checking for a condition, which is what Wait does), it is possible to run out of virtual sockets, and the driver crashes. (The lack of enough virtual sockets seems to be a known issue on Windows 7, but I can't modify my system.)
The fewer calls to the driver I issue in a short period of time, the less likely it is to overrun the number of available sockets. I have observed that the first check never returns true, and therefore it's just opening a socket for no reason, making the program more likely to crash. That's why I want to wait. I hope this explanation is helpful for someone searching for information as to why they keep getting SocketExceptions in WebDriver.
The obvious answer would be to just insert a time.sleep(2) (or similar method) before your first check. Would that work for what you're trying to do?
What is the right way to check for data in remote database through http requests in objective c iOS. I am thinking of an nstimer that is called every 5 minutes. The nstimer will trigger a function with a thread in it. Is this the right way? Is this going to work when the app enters the background?
Any help appreciated.
The thread (as like all execution in your program) will pause when entering the background - and if it was waiting on a network response, that response will fail after the app returns to the foreground.
Moreover, you need to explicitly tell iOS when you are beginning a task that you would like to continue in the background (with beginBackgroundTaskWithExpirationHandler: on your UIApplication singleton) and when you have finished that task (with endBackgroundTask:). However, that is only up to a maximum of ten minutes, so I daresay you won't be able to, say, continue your NSTimers in the background. But yes, the method you have described is fine for when the application is in the foreground.