@@ -192,6 +192,12 @@ def on_main_thread_start_app() -> None:
192192
193193
194194def _bootstrap_networking () -> None :
195+ """Early networking bootstrapping.
196+
197+ We start this as early as we can after start-app is called to
198+ give it as much time to warm-start network connections/etc. while
199+ we're spinning up other stuff.
200+ """
195201
196202 from efro .util import strict_partial
197203
@@ -219,11 +225,15 @@ def _bootstrap_networking() -> None:
219225 maxsize = 10 ,
220226 headers = {'User-Agent' : _babase .user_agent_string ()},
221227 )
222- # Kick off a request to our first-choice bootstrap server. This will
228+ # Kick off a request to our first-choice bootstrap server. This can
223229 # get dns lookup and ssl negotiation and whatnot going in the
224230 # background while the rest of our app is coming up, and our first
225231 # actual request to the server will ideally have an established
226232 # connection already waiting for it.
233+ #
234+ # We kick off a separate thread to handle this though since we don't
235+ # want the bootstrap process to block on it if its still going when
236+ # our bootstrapping results are needed.
227237 threading .Thread (
228238 target = strict_partial (
229239 _warm_start_bootstrap_connection , _g_net_warm_start_pool_manager
@@ -296,13 +306,14 @@ def should_abort() -> bool:
296306 or appstate is appstate_t .SHUTDOWN_COMPLETE
297307 )
298308
299- # Let's wait until the app has been in the running state for a few
300- # seconds before doing our thing; that way we're out of the way of
301- # more high priority stuff like meta-scans that happen at first
302- # launch.
309+ # Let's wait until the app has been in the running state for a wee
310+ # bit before doing our thing; that way we're out of the way of more
311+ # high priority stuff like meta-scans that happen at first launch.
312+ # Packing too much work in at once is likely to lead to visible
313+ # stutters and ANR issues and whatnot.
303314 time_in_running_state = 0.0
304315 sleep_inc = 0.1
305- while time_in_running_state < 3 .0 :
316+ while time_in_running_state < 10 .0 :
306317 time .sleep (sleep_inc )
307318 appstate = _babase .app .state
308319 appstate_t = type (appstate )
0 commit comments