Giter VIP home page Giter VIP logo

Comments (9)

fivdi avatar fivdi commented on July 19, 2024

Lets say your app is called app.js. Does it work if the following commands are executed?

UV_THREADPOOL_SIZE=10
node app

from bot-io.

ril3y avatar ril3y commented on July 19, 2024

@fivdi

Thanks for the reply. No increasing the threadpool had no effect. The only way to get a "repeat" button press to work is to limit the button inputs to 4 so far. Which i need 8 :) Any other thoughts? I can post my code if you like?

from bot-io.

fivdi avatar fivdi commented on July 19, 2024

Yes, post a simple example which can be used to reproduce the bug.

from bot-io.

fivdi avatar fivdi commented on July 19, 2024

The bug can be reproduced with the following code:

var bot = require('bot-io'),
  buttons = [
    new bot.Button(bot.pins.p9_23),
    new bot.Button(bot.pins.p9_24),
    new bot.Button(bot.pins.p8_07),
    new bot.Button(bot.pins.p8_08),
    new bot.Button(bot.pins.p8_09)
  ];

buttons.forEach(function (button) {
  button.on('pressed', function () {
    console.log('pressed: ' + button.name);
  });
  button.on('released', function () {
    console.log('released: ' + button.name);
  });
});

For some reason the data events for files corresponding to the buttons that are needed to detect button press and release are not being fired correctly. The JavaScript code for the data event handler is here.

What appears to be the same issue was also reported at nodejs/node-v0.x-archive#9132

from bot-io.

fivdi avatar fivdi commented on July 19, 2024

It turns out that this is related to the thread pool size. If the app is called app.js executing the following command should work (note that everything is on the same line):

UV_THREADPOOL_SIZE=10 node app

The following should also work:

export UV_THREADPOOL_SIZE=10
node app

from bot-io.

fivdi avatar fivdi commented on July 19, 2024

For more information about the thread pool see http://docs.libuv.org/en/latest/threadpool.html

from bot-io.

ril3y avatar ril3y commented on July 19, 2024

@fivdi Thanks so much! I just got home and was going to upload some code for you. However looks like your code reproduces this bug just fine. I guess its not a bug but more of a configuration mismatch. I think we should close this and put this info int the docs? Agree?

from bot-io.

fivdi avatar fivdi commented on July 19, 2024

Agreed, this should be documented.

from bot-io.

fivdi avatar fivdi commented on July 19, 2024

Documentation updated with #4

from bot-io.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.