mirror of
https://github.com/alexgo-io/stacks-subnets.git
synced 2026-04-29 12:15:25 +08:00
make all metadata directories inside the critical section
This commit is contained in:
@@ -413,18 +413,6 @@ def store_mutable_data_version(device_id, fq_data_id, ver, config_path=CONFIG_PA
|
||||
|
||||
metadata_dir = get_metadata_dir(conf)
|
||||
|
||||
if not os.path.isdir(metadata_dir):
|
||||
try:
|
||||
log.debug("Make metadata directory {}".format(metadata_dir))
|
||||
os.makedirs(metadata_dir)
|
||||
except Exception, e:
|
||||
if BLOCKSTACK_DEBUG:
|
||||
log.exception(e)
|
||||
|
||||
msg = 'No metadata directory created; cannot store version of "{}"'
|
||||
log.warning(msg.format(fq_data_id))
|
||||
return False
|
||||
|
||||
_, data_id = storage.parse_fq_data_id(fq_data_id)
|
||||
assert data_id, "Invalid fqid {}".format(fq_data_id)
|
||||
|
||||
@@ -433,6 +421,19 @@ def store_mutable_data_version(device_id, fq_data_id, ver, config_path=CONFIG_PA
|
||||
|
||||
# serialize this
|
||||
with MUTABLE_DATA_VERSION_LOCK:
|
||||
|
||||
if not os.path.isdir(metadata_dir):
|
||||
try:
|
||||
log.debug("Make metadata directory {}".format(metadata_dir))
|
||||
os.makedirs(metadata_dir)
|
||||
except Exception, e:
|
||||
if BLOCKSTACK_DEBUG:
|
||||
log.exception(e)
|
||||
|
||||
msg = 'No metadata directory created; cannot store version of "{}"'
|
||||
log.warning(msg.format(fq_data_id))
|
||||
return False
|
||||
|
||||
ver_dir = os.path.join(metadata_dir, d_id)
|
||||
if not os.path.isdir(ver_dir):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user