From c8cddf8ae553eaf71c2e6a2b6a95d6c796ec91dd Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 9 Oct 2017 04:05:18 +0300 Subject: [PATCH] minor tweak + docs... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/collections.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ui (gen4)/features/collections.js b/ui (gen4)/features/collections.js index 05c2b081..7ec677cb 100755 --- a/ui (gen4)/features/collections.js +++ b/ui (gen4)/features/collections.js @@ -234,17 +234,29 @@ var CollectionActions = actions.Actions({ // XXX should this queue already running calls or a specific collection???? // ...I think yes!! + // XXX do we need timeuts here???? ensureCollection: ['- Collections/', core.doc`Ensure a collection exists and is consistent... + Ensure collection exists and is initialized... .ensureCollection(title) -> promise(collection) + NOTE: this will not start a new check until the previous + is done (i.e. the previous promise is resolved/rejected) + + Ensure collection exists and is initialized, forcing call... + .ensureCollection(title, true) + -> promise(collection) + This will: - create a collection if it does not exist - initialize if needed + + While the promise is not resolved this will return it and not + start a new promise. `, - function(collection){ + function(collection, force){ var that = this var running = this.__running_collection_ensure = @@ -260,7 +272,7 @@ var CollectionActions = actions.Actions({ // sync collection calls... // XXX do we need timeuts here???? - if(running[collection]){ + if(!force && running[collection]){ return running[collection] }