Skip to content

Commit 8667067

Browse files
committed
Optimize creation of read/write Butlers.
Two seperate Butlers are now only created when the read and write repos are configured differently. This optimizes the case with a single central repo.
1 parent f61b903 commit 8667067

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/activator/activator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ def _get_write_butler():
180180
def _get_read_butler():
181181
"""Lazy initialization of central Butler.
182182
"""
183-
return get_central_butler(read_repo, instrument_name, writeable=False)
183+
if read_repo != write_repo:
184+
return get_central_butler(read_repo, instrument_name, writeable=False)
185+
else:
186+
# Don't initialize an extra Butler from scratch
187+
return _get_write_butler()
184188

185189

186190
@functools.cache

0 commit comments

Comments
 (0)