ibm mobilefirst - JSON store hangs while retrieving data -


we have observed @ times accessing jsonstore api's hangs long time, make work have call function again or app has taken background & bring foreground again.

note : when application faces issue, behaviour same until reinstall app or reboot device.

there doesn't appear proper scenarios this, have searched many articles did not find solution, solutions welcome.

we observed issue on android devices s5 , s4.

here code snippet:

function getwidgets(w_id, getwidgetssuccesscallback, getwidgetsfailurecallback) {  var query = { user_id : w_id }; var options = {};  wl.jsonstore.get(storagecollections.widgets).find(query, options) .then(function(arrayresults) {     var count = arrayresults.length;      logger.debug("getwidgets: success, count: " + count);      ...      getwidgetssuccesscallback(widgets); }) .fail(function(errorobject) {     logger.error("getwidgets: failed, error: " + json.stringify(errorobject));     getwidgetsfailurecallback(errorobject); });} 

logs when works fine http://pastebin.com/nvp8yctg

logs when accessing json store hangs, work when app taken background & bring foreground again http://pastebin.com/eyzx57qc

json store initialised below

var collections = { // user user: {     searchfields: {         user_id             : 'string',         user_name           : 'string',         first_name          : 'string',         last_name           : 'string',     }            } }};   // storage encryption var options = {}; if (key) {     options.password = key;     options.localkeygen = true; }  // open collection var promise = wl.jsonstore.init(collections, options) .then(function() {     logger.debug("initializeappstorage: " + json.stringify(collections) + " completed");     initappstoragesuccesscallback(true);     return true; }) // handle failure .fail(function(errorobject) {     logger.error("initializeappstorage: failed, error: " + errorobject.tostring());     initappstoragefailurecallback(errorobject.tostring());     return false; }); return promise; 

thanks.

try 1 :

function getwidgets(w_id, getwidgetssuccesscallback, getwidgetsfailurecallback) {  var query = { key : w_id }; var options = {};  wl.jsonstore.get(storagecollections.widgets).find(query, options) .then(function(arrayresults) {     var count = arrayresults.length;      logger.debug("getwidgets: success, count: " + count);      ...      getwidgetssuccesscallback(widgets); }) .fail(function(errorobject) {     logger.error("getwidgets: failed, error: " + json.stringify(errorobject));     getwidgetsfailurecallback(errorobject); });} 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -