diff --git a/esp/services/ws_store/espstorelib/daliKVStore.cpp b/esp/services/ws_store/espstorelib/daliKVStore.cpp index d3647f5cdb2..0db602bab54 100644 --- a/esp/services/ws_store/espstorelib/daliKVStore.cpp +++ b/esp/services/ws_store/espstorelib/daliKVStore.cpp @@ -38,6 +38,11 @@ bool CDALIKVStore::createStore(const char * apptype, const char * storename, con } } + //target store does not exist, let's create it + //re-establish connection with write lock + conn.clear(); + conn.setown(querySDS().connect(DALI_KVSTORE_PATH, myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT_KVSTORE)); + Owned apptree = createPTree(); apptree->setProp(DALI_KVSTORE_NAME_ATT, storename); CDateTime dt; @@ -58,8 +63,6 @@ bool CDALIKVStore::createStore(const char * apptype, const char * storename, con if (maxvalsize != 0) apptree->setPropInt(DALI_KVSTORE_MAXVALSIZE_ATT, maxvalsize); - conn->changeMode(RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT_KVSTORE); - Owned root = conn->getRoot(); if (root->hasProp(xpath.str())) {