-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature coalescing support #23
Conversation
Hold off on review until tests have been made. |
… that hadn't ended yet. Added test for coalescing.
Added integration test. |
@@ -14,14 +14,13 @@ module.exports = Datastore; | |||
*/ | |||
function Datastore() { | |||
// TODO: Switch this to something that can manage the size, evict old, etc. LRU maybe? | |||
this.cache = {}; | |||
this.cache = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarification: Any reason this needs to be an array instead of object ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. That was never reverted back. It should be an object.
@FunnyGopher Looks like there are some conflicts (possibly due to other branch that got merged with develop). Could you merge develop onto this branch and resolve conflicts ? |
Thanks for pointing that out. I need to go back and revert some of the code. |
* @returns [] of jobs | ||
*/ | ||
Factory.prototype.getJobs = function getJobs() { | ||
var datastore = this.jobs.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Possibly use https://lodash.com/docs#values
b196027
to
abf02be
Compare
abf02be
to
173ac68
Compare
Added coalescing support to save resources. Coalescing time window can be configured in the config in the "coalescingPeriod" property. Duplicate requests that are fired while a job is building will be thrown away and redirected to the running job. Duplicate requests that are fired during the coalescing period will also be thrown away and redirected to the original job.