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

Refactor #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Refactor #2

wants to merge 2 commits into from

Conversation

parrish
Copy link

@parrish parrish commented Sep 4, 2014

Hi,

I'm not sure if metroplex was previously working as intended or not. When I tried it, all of the keys in Redis were deleted after the interval had expired except for the server:alive keys.

I started trying to fix it and ended up writing a large-ish refactor of how it uses Redis. I've also setup a spark TTL heartbeat using the client ping transmissions and expanded the tests a bit.

Feedback, questions, and suggestions are definitely welcome.

@3rd-Eden
Copy link
Member

3rd-Eden commented Sep 4, 2014

Mother of all pull requests. I'll review it in the morning, thanks for taking the effort!


if (fn) fn(err, metroplex.address);
});
metroplex.redis.psetex(metroplex.namespace + 'server:' + metroplex.address, metroplex.interval, Date.now(), function(err, result) {
Copy link
Member

Choose a reason for hiding this comment

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

I know that redis commands can fail only if called with a wrong syntax or against keys holding the wrong data type, but I would handle the error anyway, in the same way it was handled before.

@lpinca
Copy link
Member

lpinca commented May 25, 2015

@parrish after ~8 months I've finally taken a look at this pr, sorry about that.
I've added some comments, but overall this LGTM.

The biggest difference lies in how the sparks are stored in Redis. Right now they are stored in a hash to optimize the memory. With this patch instead, each spark has its own key, making it possible to add an individual timeout to each one of these.

I let @3rd-Eden decide what to do with this pr.

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.

3 participants