TheThingSystem / steward

The Thing System is a set of software components and network protocols that aims to fix the Internet of Things. Our steward software is written in node.js making it both portable and easily extensible. It can run on your laptop, or fit onto a small single board computer like the Raspberry Pi.
http://thethingsystem.com
Other
346 stars 81 forks source link

review use of YAPI calls in gateway-yoctopuce-hub.js #252

Closed mrose17 closed 10 years ago

mrose17 commented 10 years ago

see which any calls in "the inner loop" can be made async, and do so...

mrose17 commented 10 years ago

my guess is that somewhere in this code:

    result = yapi.yRegisterHub(self.url);
    if (result != yapi.YAPI_SUCCESS) return logger.error('device/' + self.deviceID, { event: 'yRegisterHub', result: result });

    yapi.yUpdateDeviceList();
    setTimeout(function() {
      var module;

      for (module = yapi.yFirstModule(); !!module; module = module.nextModule()) self.addstation(module);
    }, 0);

things are going "synchronous" with XMLHTTPRequest, and sometimes it seems to lock up! (the hub in question is wireless and goes in and out of signal, at times). can the yRegisterHub() or yUpdateDeviceList() calls be made asynchronous?