Skip to content

Rewrite bee-queue 1.0.0 - #64

Merged
skeggse merged 84 commits into
bee-queue:masterfrom
mixmaxhq:master
Aug 9, 2017
Merged

skeggse merged 84 commits into
bee-queue:masterfrom
mixmaxhq:master

Conversation

@skeggse

@skeggse skeggse commented Jul 13, 2017 •

Copy link
Copy Markdown
Member

Note that we haven't re-attained 100% code coverage, and that's the biggest blocker to considering this ready to merge.

Comment thread HISTORY.md Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these new features need to be documented in the readme

Comment thread package.json Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bee-queue/bee-queue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with other places in this file

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thought I got these all. Done.

Comment thread lib/job.js Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting should be documented in readme

Comment thread package.json Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd much prefer if we pin these. I'm guessing it's just oversight, but I'm happy to discuss if you'd explicitly rather not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to not pin dependencies, because it seems more the job of the application to ensure that its dependencies are locked. In our case, we use yarn, but other folks may use npm shrinkwrap or lockfiles. For us, not pinning dependencies is beneficial because yarn deduplicates common dependencies.

@skeggse
skeggse force-pushed the master branch 2 times, most recently from 5a1a305 to e7aee81 Compare July 13, 2017 04:32
@LewisJEllis

LewisJEllis commented Jul 13, 2017 •

Copy link
Copy Markdown
Member

My 10-minute skim impression/thoughts:

  • Looks great overall, you've kept along a lot of the original ideas/tenets I had when starting this and polished it to be 2017 JS instead of 2015 JS. Most of the spots where the 2-years-later version of me sees room for stuff to be better, it is, especially around tooling/CI/etc.
  • Good move on the promise transition. I skipped them previously to dodge bluebird/a compilation step/node 0.12's sketchy promise situation, but now that they're a standard language feature (along with async/await) I'm happy to see/use them. Curious about your thoughts on the option of moving to an entirely promise-first API and maybe obviating the need for promise-callback?
  • I'm gonna have to go through in more detail to understand the new timer stuff and the new behavior for stalling/delayed jobs; definitely adds complexity, but it looks well-thought-out.

It sounds like you're still working on tests, which do make review easier, so I'm inclined to wait on those, but just let me know whenever you think they're in good shape for review. Maybe that's even now, I'm not sure - happy to review now during WIP or wait, just let me know either way. Just hoping to avoid leaving comments of "there should be a test for this" when you already know :)

@LewisJEllis

Copy link
Copy Markdown
Member

Oh, also definitely looking for more readme updating, especially if you want to go waving a flag of "hey we're updated and back in action". I'd guess my initial release time breakdown was 1:1:1 impl/tests/readme, and I think that was a significant factor to why this initially caught some adoption (well, that and the whim of the editor of the Node Weekly newsletter...).

@bradvogel

Copy link
Copy Markdown

@LewisJEllis fyi: we're still debugging one last issue with this PR (running this in production!). So wait on reviewing.

@skeggse

skeggse commented Jul 19, 2017

Copy link
Copy Markdown
Member Author

@LewisJEllis it looks like maybe Coveralls isn't functioning now that bee-queue moved to its own organization. I'm not able to get Coveralls to discover bee-queue via my account, can you take a look?

@LewisJEllis

Copy link
Copy Markdown
Member

Sure thing - I went into my coveralls account and hit some sort of button that turned https://coveralls.io/github/lewisjellis/bee-queue into https://coveralls.io/github/bee-queue/bee-queue and synced/updated everything; I think it should try to do a report on the next push, so give it a try. If that doesn't work, you also might try moving to a new PR that's on a branch in this repo rather than on the mixmaxhq fork.

@coveralls

coveralls commented Jul 19, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 92535f4 on mixmaxhq:master into ** on bee-queue:master**.

@coveralls

coveralls commented Jul 20, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 0db0f76 on mixmaxhq:master into ** on bee-queue:master**.

@skeggse

skeggse commented Jul 20, 2017

Copy link
Copy Markdown
Member Author

We're running into what may be a performance regression Node-side (Redis is still performing quite nicely) - I suspect that the switch to promises, especially ES6 promises, may be creating substantially more objects than we expected. I'm seeing GC overhead of up to 15% in production. Thoughts about performance and promises, @LewisJEllis? It looks like maybe bluebird is more optimized relative to es6 promises, so maybe we could support overriding the Promise implementation at runtime.

@coveralls

coveralls commented Jul 20, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling fad6899 on mixmaxhq:master into ** on bee-queue:master**.

@coveralls

coveralls commented Aug 8, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 4574ac0 on mixmaxhq:master into ** on bee-queue:master**.

Comment thread lib/queue.js
this._delayedTimer = new EagerTimer(this.settings.nearTermWindow);
this._delayedTimer.on('trigger', this._activateDelayed.bind(this));
// To avoid changing the hidden class of the Queue.
this._delayedTimer = this.settings.activateDelayedJobs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could just be

if (this.settings.activateDelayedJobs) {
  this._delayedTimer = new EagerTimer(this.settings.nearTermWindow);
  this._delayedTimer.on('trigger', this._activateDelayed.bind(this));
}

The if (this._delayedTimer) { check will still work the same way with _delayedTimer just being undefined instead of null.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it'd work. I prefer to keep properties on objects in all cases, because doing otherwise introduces a different hidden class. I don't expect that to really have any performance benefits. I also think it's nice to always have the full set of properties always present on an object, so you can see them easily in the REPL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I'm also doubtful it would have any performance benefit since it's just 1 vs 2, not 1 vs 20 or log(n) or n - but the "always see all properties in REPL" bit is a fair point that I hadn't considered. Sounds good as is.

Comment thread lib/queue.js Outdated
// down during this operation.
return this._commandable().then((client) => {
const got = helpers.deferred();
const commandArgs = [this.toKey('jobs')].concat(idsArray, got.defer());

@LewisJEllis LewisJEllis Aug 8, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous getJobs implementation, by deferring to getJob and fromId we would just use the job instance from the local jobs map if available; here it seems we fetch all jobs from redis and make new instances. Could we continue to use the local instances that are already available and only hmget the missing ones?

@LewisJEllis LewisJEllis Aug 8, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My specific thinking here is that this could have some benefit in the use case of "arena is sitting here calling getJobs every 10 seconds to keep an up-to-date dashboard display of jobs that are waiting/failed/etc". I have no idea if arena in particular actually does something like that or if the intent is to use it like that, but it seems like a reasonable monitoring possibility.

@LewisJEllis LewisJEllis Aug 8, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although on second thought, maybe in that case we would want to have disabled storeJobs on that queue instance anyway to avoid memory issues, and so this wouldn't make any difference. I guess the "watch jobs that have failed" use case wouldn't be so sensitive to it assuming we don't end up with many failed jobs, but for the "watch jobs that are waiting" use case we would almost certainly want to have storeJobs disabled.

So I think my current take is "probably doesn't actually matter, fine as is", but curious what you think. Also curious what @randallm thinks from the arena usage perspective.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related. I'm adding this functionality, but it won't be used in Arena for them time being.

@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 66d8cf0 on mixmaxhq:master into ** on bee-queue:master**.

4 similar comments
@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 66d8cf0 on mixmaxhq:master into ** on bee-queue:master**.

@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 66d8cf0 on mixmaxhq:master into ** on bee-queue:master**.

@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 66d8cf0 on mixmaxhq:master into ** on bee-queue:master**.

@coveralls

coveralls commented Aug 8, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 66d8cf0 on mixmaxhq:master into ** on bee-queue:master**.

@coveralls

coveralls commented Aug 8, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 936b9b6 on mixmaxhq:master into ** on bee-queue:master**.

@LewisJEllis LewisJEllis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ready!

@skeggse
skeggse merged commit ffe5194 into bee-queue:master Aug 9, 2017
@skeggse

skeggse commented Aug 9, 2017

Copy link
Copy Markdown
Member Author

🎉

@LewisJEllis

Copy link
Copy Markdown
Member

Added a .npmignore in a8e7183 and published!

@skeggse

skeggse commented Aug 9, 2017

Copy link
Copy Markdown
Member Author

The other option there, @LewisJEllis, is to specify a whitelist via the files array in the package.json.

@LewisJEllis

Copy link
Copy Markdown
Member

Oh, nice, TIL. That seems way easier given that I started with a whitelist in the comments of the .npmignore.

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.

5 participants