Skip to content

Commit 72a0f66

Browse files
committed
Revert parallel session file loading
Revert the ThreadPoolExecutor-based parallel Session.load() back to sequential calls. The parallel approach will be submitted separately for further review.
1 parent af398fb commit 72a0f66

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/azure-cli-core/azure/cli/core/__init__.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,14 @@ def __init__(self, **kwargs):
9898

9999
azure_folder = self.config.config_dir
100100
ensure_dir(azure_folder)
101-
102-
# Load session files in parallel — each open() costs ~20ms on Windows due to
103-
# filesystem/antivirus overhead, and file I/O releases the GIL.
104-
from concurrent.futures import ThreadPoolExecutor
105-
load_tasks = [
106-
(ACCOUNT, os.path.join(azure_folder, 'azureProfile.json'), 0),
107-
(CONFIG, os.path.join(azure_folder, 'az.json'), 0),
108-
(SESSION, os.path.join(azure_folder, 'az.sess'), 3600),
109-
(INDEX, os.path.join(azure_folder, 'commandIndex.json'), 0),
110-
(EXTENSION_INDEX, os.path.join(azure_folder, 'extensionIndex.json'), 0),
111-
(HELP_INDEX, os.path.join(azure_folder, 'helpIndex.json'), 0),
112-
(EXTENSION_HELP_INDEX, os.path.join(azure_folder, 'extensionHelpIndex.json'), 0),
113-
(VERSIONS, os.path.join(azure_folder, 'versionCheck.json'), 0),
114-
]
115-
with ThreadPoolExecutor(max_workers=len(load_tasks)) as pool:
116-
futures = [pool.submit(s.load, path, max_age=age) for s, path, age in load_tasks]
117-
for f in futures:
118-
f.result()
101+
ACCOUNT.load(os.path.join(azure_folder, 'azureProfile.json'))
102+
CONFIG.load(os.path.join(azure_folder, 'az.json'))
103+
SESSION.load(os.path.join(azure_folder, 'az.sess'), max_age=3600)
104+
INDEX.load(os.path.join(azure_folder, 'commandIndex.json'))
105+
EXTENSION_INDEX.load(os.path.join(azure_folder, 'extensionIndex.json'))
106+
HELP_INDEX.load(os.path.join(azure_folder, 'helpIndex.json'))
107+
EXTENSION_HELP_INDEX.load(os.path.join(azure_folder, 'extensionHelpIndex.json'))
108+
VERSIONS.load(os.path.join(azure_folder, 'versionCheck.json'))
119109
handle_version_update()
120110

121111
self.cloud = get_active_cloud(self)

0 commit comments

Comments
 (0)