cli.py: move timing check back to top
We care about how long it takes to import all the wormhole-specific things, to investigate user-perceived latency from the time the command is launched to the time they can actually interact with it. So we need to record `time.time()` before doing the rest of the imports, even though pep8 says all imports should be done before any non-importing statements.
This commit is contained in:
parent
1444e32746
commit
fc177726e1
|
@ -2,23 +2,24 @@ from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from sys import stderr, stdout
|
start = time.time()
|
||||||
from textwrap import dedent, fill
|
|
||||||
|
|
||||||
import click
|
from sys import stderr, stdout # noqa: E402
|
||||||
import six
|
from textwrap import dedent, fill # noqa: E402
|
||||||
from twisted.internet.defer import inlineCallbacks, maybeDeferred
|
|
||||||
from twisted.internet.task import react
|
|
||||||
from twisted.python.failure import Failure
|
|
||||||
|
|
||||||
from . import public_relay
|
import click # noqa: E402
|
||||||
from .. import __version__
|
import six # noqa: E402
|
||||||
from ..errors import (KeyFormatError, NoTorError, ServerConnectionError,
|
from twisted.internet.defer import inlineCallbacks, maybeDeferred # noqa: E402
|
||||||
|
from twisted.internet.task import react # noqa: E402
|
||||||
|
from twisted.python.failure import Failure # noqa: E402
|
||||||
|
|
||||||
|
from . import public_relay # noqa: E402
|
||||||
|
from .. import __version__ # noqa: E402
|
||||||
|
from ..errors import (KeyFormatError, NoTorError, # noqa: E402
|
||||||
|
ServerConnectionError,
|
||||||
TransferError, UnsendableFileError, WelcomeError,
|
TransferError, UnsendableFileError, WelcomeError,
|
||||||
WrongPasswordError)
|
WrongPasswordError)
|
||||||
from ..timing import DebugTiming
|
from ..timing import DebugTiming # noqa: E402
|
||||||
|
|
||||||
start = time.time()
|
|
||||||
|
|
||||||
top_import_finish = time.time()
|
top_import_finish = time.time()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user