From b6f1a6085f7470c16ae8850e7da8f4f9ae5c23ee Mon Sep 17 00:00:00 2001 From: Leland Richardson Date: Tue, 21 Nov 2017 13:57:47 -0800 Subject: [PATCH] Increase prepare js timeout Summary: We run into this timeout virtually every live-reload now, which I believe is just a function of the size of our React Native code base. Looking at the code, right now the prepare JS call is run and retried 3 times, with a wait/timeout of 1s each. On android, it's done 3 times with a wait/timeout of 5s on each. For consistency, I've updated it to be the same timeout as on android. Trying this with our project, we no longer get red-boxes when we live-reload for the first time. I've run this on our project locally, and it fixed the issue. It's a very simple change, so I don't believe any additional testing should be needed. [IOS][BUGFIX][RCTWebsocketExecutor] - Increased timeout to prevent false-positive redbox during development of large RN code base Closes https://github.com/facebook/react-native/pull/16794 Differential Revision: D6387545 Pulled By: shergin fbshipit-source-id: c6e58fb82e072c01f9e1277a58d2640d6140a8c7 --- Libraries/WebSocket/RCTWebSocketExecutor.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/WebSocket/RCTWebSocketExecutor.m b/Libraries/WebSocket/RCTWebSocketExecutor.m index 520337178f7ba9..cb70fc33f3292c 100644 --- a/Libraries/WebSocket/RCTWebSocketExecutor.m +++ b/Libraries/WebSocket/RCTWebSocketExecutor.m @@ -117,7 +117,7 @@ - (BOOL)prepareJSRuntime initError = error; dispatch_semaphore_signal(s); }]; - long runtimeIsReady = dispatch_semaphore_wait(s, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC)); + long runtimeIsReady = dispatch_semaphore_wait(s, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 5)); if (initError) { RCTLogInfo(@"Websocket runtime setup failed: %@", initError); }