mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
provision: Fix buggy management of apt_dependencies_hash.
Apparently, we were incorrectly appending each new hash onto the end of the file, basically resulting in every run of provision being treated as a miss for this cache. Fixing this saves about 4s (over 1/3) of the no-op provision time.
This commit is contained in:
@@ -226,11 +226,10 @@ def main(options):
|
||||
last_apt_dependencies_hash = None
|
||||
apt_hash_file_path = os.path.join(UUID_VAR_PATH, "apt_dependencies_hash")
|
||||
try:
|
||||
hash_file = open(apt_hash_file_path, 'r+')
|
||||
hash_file = open(apt_hash_file_path, 'r')
|
||||
last_apt_dependencies_hash = hash_file.read()
|
||||
except IOError:
|
||||
run(['touch', apt_hash_file_path])
|
||||
hash_file = open(apt_hash_file_path, 'r+')
|
||||
|
||||
if (new_apt_dependencies_hash != last_apt_dependencies_hash):
|
||||
try:
|
||||
@@ -245,6 +244,7 @@ def main(options):
|
||||
# recover automatically.
|
||||
run(['sudo', 'apt-get', 'update'])
|
||||
install_apt_deps()
|
||||
hash_file = open(apt_hash_file_path, 'w')
|
||||
hash_file.write(new_apt_dependencies_hash)
|
||||
else:
|
||||
print("No changes to apt dependencies, so skipping apt operations.")
|
||||
|
||||
Reference in New Issue
Block a user