improved initial master-server connection times/logging

This commit is contained in:
Eric Froemling 2024-12-14 04:31:20 -08:00
parent 1aa3e39ec5
commit a81d59bfac
No known key found for this signature in database
7 changed files with 91 additions and 76 deletions

72
.efrocachemap generated
View File

@ -4103,42 +4103,42 @@
"build/assets/windows/Win32/ucrtbased.dll": "bfd1180c269d3950b76f35a63655e9e1",
"build/assets/windows/Win32/vc_redist.x86.exe": "15a5f1f876503885adbdf5b3989b3718",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "6a6b5a81a0398637ab032501ebef45e0",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "e25e7120708abad6a26c202e3f43f2a1",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "38c6cd9d1fda895d5438a127cc4025df",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "58391fd251fa3698fd60e49f8ffab8dd",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "de106a0d319b579487b3f49d9a839de0",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "e02ae01dc7922b1324a506805aade940",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "dfffbd298de9818511e85a92b9b896f2",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "b778c94e161a86c69c9d9279a33f99e2",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "e16970fb9f8cf72e74a957126feff8f2",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "081674ba8c39a729d0ca0cdd4e18e7c5",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "05690b982897eab49ca81b44ccf128a9",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "66622ba04928e7c27a2fc56188fa199d",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "b4719f8a13595a66c706597c7f8d5af4",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "2c946e8429e6e30c31ff233ff12e40ba",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "05f5752ee8889cda4c084b5475872aea",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "81a6e9ea469430c4d3e960d998e80f93",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "70370c724e34f5e84c2af6ea3a5c70a4",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "59bd83efb949ff66e8845ee1b6f04deb",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "70370c724e34f5e84c2af6ea3a5c70a4",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "59bd83efb949ff66e8845ee1b6f04deb",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "a102df2262d65b3e7368be2092c39032",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "bd88ede126790cb71c571817ba97a055",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "a102df2262d65b3e7368be2092c39032",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "bd88ede126790cb71c571817ba97a055",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "82c4761b385f40fbb78c4538ce22356f",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "48c26b5899970ceaeaa09d47de7537dc",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "82c4761b385f40fbb78c4538ce22356f",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "48c26b5899970ceaeaa09d47de7537dc",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "f911b4274de1beffbd32edbcb66ebff8",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "0e4e1340b2dbe074546d3831af9d115a",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "7f67b5ed4ce5c72103f0eb920597e8c9",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "9c706ceda2432513ecb3bb14b57ccab8",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "e95a15ac3ed57d1177a2a877feb7de15",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "77453446385b7a35a7e9b16f42009616",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "e4d1fb62b0a0a67e92c7a20461acd18d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "956281fe24cdd7c420440c47334f3bf9",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "c8016b5962a9013f94e3af05997d1a28",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "51c5d1377cabdddb514bcc5d67cff181",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "ec871a338037c8e00bfef4515119e7cd",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "5dcc27823da279ffb31a704c887aeb54",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "4edd45b4d6b7550c3aefd8c64f54a3b9",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "2bddb3ec1fd7b3d345d34ce482f8a39d",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "ed41e2951939f7f8ecd2471c94420e4d",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "5fc1f21e0eef1b2122b08f37c34f3272",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "1cfc51382109d342bdbccc305f0910c8",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "330209da34ba652e10bf00fc38e0c46a",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "9cbe6bd4acfedd8cd90b075ee7af97ae",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "6fac95914873d4b20b2af1f096ace136",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "cc1bf9f7a2aa9f2e4cd575debe9e08c8",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "05ae9c00ffe153f2f35dd9284a439c17",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "7349c74e6c4b38620ec64cef45ee2a99",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "c62d5f9ec3f224bb7659080aabe8584e",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "7f06a3e871169a315fea2e76d1bd01db",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "845d1afbd32dbb82b6135f71ef6cc8f3",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "7f06a3e871169a315fea2e76d1bd01db",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "845d1afbd32dbb82b6135f71ef6cc8f3",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "3587a55cfce3bb8bcdc80566b37b34cf",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "167792a508037190954a60aa1f28f57b",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "3587a55cfce3bb8bcdc80566b37b34cf",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "167792a508037190954a60aa1f28f57b",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "bef2edf6cb26edc42ef7f27476c96309",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "704500ce5a49e58d33508b4d74deaac8",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "bef2edf6cb26edc42ef7f27476c96309",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "704500ce5a49e58d33508b4d74deaac8",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "110191eaa720b45fe4faa4ab71733cce",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "62e3a11647932c78589888338aa2dd37",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "93429c7115697703950aaa8fa084e33b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "bc2a31bddb8b907ac93f04c6a06e543b",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "c1483f74b2117bcf17e72743a7e53a1e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "94a9e8f13ee739ea5dae7c816db355e2",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "6a00610da4d3992afb5b2d19e719cfec",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "9e6053eb6c521a55690101b40e762201",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91",

View File

@ -4,7 +4,7 @@ filelock==3.16.1
furo==2024.8.6
mypy==1.13.0
pbxproj==4.2.1
pdoc==15.0.0
pdoc==15.0.1
pur==7.3.3
pylint==3.3.2
pylsp-mypy==0.6.9

View File

@ -204,7 +204,7 @@ class ClassicAppMode(babase.AppMode):
def _on_classic_account_data_change(
self, val: bacommon.cloud.BSClassicAccountLiveData
) -> None:
# print('ACCOUNT CHANGED', val)
# print('ACCOUNT CHANGED:', val)
achp = round(val.achievements / max(val.achievements_total, 1) * 100.0)
ibc = str(val.inbox_count)
if val.inbox_count_is_max:

View File

@ -15,7 +15,6 @@ if TYPE_CHECKING:
from efro.message import Message, Response
import bacommon.cloud
logger = logging.getLogger('ba.cloud')
# TODO: Should make it possible to define a protocol in bacommon.cloud and
# autogenerate this. That would give us type safety between this and
@ -40,7 +39,7 @@ class CloudSubsystem(babase.AppSubsystem):
def on_connectivity_changed(self, connected: bool) -> None:
"""Called when cloud connectivity state changes."""
logger.debug('Connectivity is now %s.', connected)
babase.balog.debug('Connectivity is now %s.', connected)
plus = babase.app.plus
assert plus is not None

View File

@ -347,8 +347,10 @@ class BSClassicAccountLiveData:
BSClassicChestAppearance,
IOAttrs('a', enum_fallback=BSClassicChestAppearance.UNKNOWN),
]
create_time: Annotated[datetime.datetime, IOAttrs('c')]
unlock_tokens: Annotated[int, IOAttrs('tk')]
unlock_time: Annotated[datetime.datetime, IOAttrs('t')]
ad_unlock_time: Annotated[datetime.datetime | None, IOAttrs('at')]
ad_allow_time: Annotated[datetime.datetime | None, IOAttrs('at')]
class LeagueType(Enum):
"""Type of league we are in."""

View File

@ -35,6 +35,8 @@ TOOL_NAME = 'bacloud'
TIMEOUT_SECONDS = 60 * 5
VERBOSE = os.environ.get('BACLOUD_VERBOSE') == '1'
# Server we talk to (can override via env var).
BACLOUD_SERVER = os.getenv('BACLOUD_SERVER', 'ballistica.net')
@ -154,33 +156,44 @@ class App:
),
}
# Trying urllib for comparison (note that this doesn't support
# files arg so not actually production ready)
if bool(False):
import urllib.request
import urllib.parse
try:
# Trying urllib for comparison (note that this doesn't support
# files arg so not actually production ready)
if bool(False):
import urllib.request
import urllib.parse
with urllib.request.urlopen(
urllib.request.Request(
url, urllib.parse.urlencode(rdata).encode(), headers
)
) as raw_response:
if raw_response.getcode() != 200:
raise RuntimeError('Error talking to server')
response_content = raw_response.read().decode()
with urllib.request.urlopen(
urllib.request.Request(
url, urllib.parse.urlencode(rdata).encode(), headers
)
) as raw_response:
if raw_response.getcode() != 200:
raise RuntimeError('Error talking to server')
response_content = raw_response.read().decode()
# Using requests module.
else:
with requests.post(
url,
headers=headers,
data=rdata,
files=files,
timeout=TIMEOUT_SECONDS,
) as response_raw:
response_raw.raise_for_status()
assert isinstance(response_raw.content, bytes)
response_content = response_raw.content.decode()
# Using requests module.
else:
with requests.post(
url,
headers=headers,
data=rdata,
files=files,
timeout=TIMEOUT_SECONDS,
) as response_raw:
response_raw.raise_for_status()
assert isinstance(response_raw.content, bytes)
response_content = response_raw.content.decode()
except Exception as exc:
if VERBOSE:
import traceback
traceback.print_exc()
raise CleanError(
'Unable to talk to bacloud server.'
' Set env-var BACLOUD_VERBOSE=1 for details.'
) from exc
assert response_content is not None
response = dataclass_from_json(ResponseData, response_content)

View File

@ -476,20 +476,17 @@ def wsl_build_check_win_drive() -> None:
),
_wrap(
'Visual Studio compiles will error here'
' for reasons related'
' to Linux filesystem case-sensitivity, and thus are'
' disallowed.'
' for reasons related to Linux filesystem'
' case-sensitivity, and thus are disallowed.'
' Clone the repo to a location that maps to a native'
' Windows drive such as \'/mnt/c/ballistica\''
' and try again.'
),
_wrap(
'Note that WSL2 filesystem performance'
' is poor when accessing'
' native Windows drives,'
' so if Visual Studio builds are not'
' needed it may be best to keep things here'
' on the Linux filesystem.'
' is poor when accessing native Windows drives,'
' so if Visual Studio builds are not needed it may'
' be best to keep things here on the Linux filesystem.'
' This behavior may differ under WSL1 (untested).'
),
_wrap(
@ -643,8 +640,9 @@ def asset_package_assemble() -> None:
"""Assemble asset package data and its manifest."""
import os
import subprocess
from efro.error import CleanError
from efro.error import CleanError
from efro.terminal import Clr
from efrotools.project import getprojectconfig
pcommand.disallow_in_batch()
@ -671,6 +669,9 @@ def asset_package_assemble() -> None:
)
try:
print(
f'{Clr.BLU}Assembling {apversion} ({flavor} flavor)...', flush=True
)
subprocess.run(
[
f'{pcommand.PROJROOT}/tools/bacloud',
@ -683,5 +684,5 @@ def asset_package_assemble() -> None:
)
except Exception as exc:
raise CleanError(
f'Failed to assemble {apversion}' f' ({flavor} flavor).'
f'Failed to assemble {apversion} ({flavor} flavor).'
) from exc