Skip to content

Commit

Permalink
HPCC-31181 Code Review 3
Browse files Browse the repository at this point in the history
- Minor code block shift

Signed-off-by: Rodrigo Pastrana <[email protected]>
  • Loading branch information
rpastrana committed Feb 9, 2024
1 parent 6cb673c commit ba70136
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions esp/services/ws_store/espstorelib/daliKVStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ bool CDALIKVStore::createStore(const char * apptype, const char * storename, con
conn.clear();
conn.setown(querySDS().connect(DALI_KVSTORE_PATH, myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT_KVSTORE));

Owned<IPropertyTree> root = conn->getRoot();
//was the target store created while we were waiting for the lock?
//if so, we don't need to create it again
if (root->hasProp(xpath.str()))
{
LOG(MCuserInfo,"DALI Keystore createStore(): '%s' entry already exists", storename);
return false;
}

Owned<IPropertyTree> apptree = createPTree();
apptree->setProp(DALI_KVSTORE_NAME_ATT, storename);
CDateTime dt;
Expand All @@ -63,13 +72,6 @@ bool CDALIKVStore::createStore(const char * apptype, const char * storename, con
if (maxvalsize != 0)
apptree->setPropInt(DALI_KVSTORE_MAXVALSIZE_ATT, maxvalsize);

Owned<IPropertyTree> root = conn->getRoot();
if (root->hasProp(xpath.str()))
{
LOG(MCuserInfo,"DALI Keystore createStore(): '%s' entry already exists", storename);
return false;
}

root->addPropTree("Store", LINK(apptree));

conn->commit();
Expand Down

0 comments on commit ba70136

Please sign in to comment.