Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demonstrate average stats exceeding maxTimeout #85

Closed

Conversation

TimDaub
Copy link
Contributor

@TimDaub TimDaub commented Jun 30, 2022

Demonstrates the effect documented in #81. But it's not super significant actually... I thought I could manipulate average arbitrarily, but so far I didn't manage. Seems more like a slip in the calculation somewhere or that it's not exactly killed after maxTimeout was reached.

> [email protected] test /Users/timdaub/Projects/better-queue
> mocha



  Complex Queue
    1) should remove tasks taking longer than maxTimeout


  0 passing (1s)
  1 failing

  1) Complex Queue should remove tasks taking longer than maxTimeout:

      Uncaught AssertionError [ERR_ASSERTION]: maxTimeout was set to "1" but average task processing time is "1.3592814371257484"
      + expected - actual

      -false
      +true

      at Queue.<anonymous> (test/complex.js:148:9)
      at Worker.<anonymous> (lib/queue.js:620:12)
      at Worker.failedTask (lib/worker.js:137:10)
      at lib/worker.js:124:10
      at Array.forEach (<anonymous>)
      at Worker.failedBatch (lib/worker.js:122:30)
      at Timeout._onTimeout (lib/queue.js:605:14)
      at listOnTimeout (internal/timers.js:557:17)
      at processTimers (internal/timers.js:500:7)



npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/timdaub/.npm/_logs/2022-06-30T07_41_27_553Z-debug.log

@TimDaub
Copy link
Contributor Author

TimDaub commented Jun 30, 2022

OK, managed to replicate it in 2908a02


> [email protected] test /Users/timdaub/Projects/better-queue
> mocha



  Complex Queue
    1) should remove tasks taking longer than maxTimeout


  0 passing (1s)
  1 failing

  1) Complex Queue should remove tasks taking longer than maxTimeout:

      Uncaught AssertionError [ERR_ASSERTION]: maxTimeout was set to "1" but average task processing time is "595.9321357285429"
      + expected - actual

      -false
      +true

      at Queue.<anonymous> (test/complex.js:153:9)
      at Worker.<anonymous> (lib/queue.js:620:12)
      at Worker.failedTask (lib/worker.js:137:10)
      at lib/worker.js:124:10
      at Array.forEach (<anonymous>)
      at Worker.failedBatch (lib/worker.js:122:30)
      at Timeout._onTimeout (lib/queue.js:605:14)
      at listOnTimeout (internal/timers.js:557:17)
      at processTimers (internal/timers.js:500:7)



npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/timdaub/.npm/_logs/2022-06-30T07_50_27_463Z-debug.log

@TimDaub
Copy link
Contributor Author

TimDaub commented Jun 30, 2022

I guess my question is: What does average describe. The total time a single task processes in the queue (like only compute time)? Or the total time a task spends in a queue (waiting + processing)?

@leanderlee
Copy link
Member

Ah, according to the code it's time since it's been queued (waiting + processing). If you only want to know the processing time average, we would need to add another property. Either way we should probably clarify what average means in the docs. #81

@leanderlee leanderlee closed this Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants