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

Re-implement a working hot reload? #2

Open
clux opened this issue Apr 20, 2015 · 3 comments
Open

Re-implement a working hot reload? #2

clux opened this issue Apr 20, 2015 · 3 comments

Comments

@clux
Copy link
Owner

clux commented Apr 20, 2015

Catching the load error is a bad idea

Probably should isolate the gu process somehow.

@clux
Copy link
Owner Author

clux commented Apr 20, 2015

Think we can use cluster for this:

  • cluster master controls the the transport stream like irc-stream
  • cluster worker controls gu
  • master communicates with worker in somehow
  • if gu crashes, restart worker, rework communication

At worst, if this works, we'll have messages being dropped - which is what we want to happen anyway, as opposed to the client dropping.

@clux
Copy link
Owner Author

clux commented Apr 20, 2015

Something like this.

if (cluster.isMaster) {
  var worker = cluster.fork();
  worker.on('message', function (msg) {
    ircStream.write(msg);
  });
  ircStream.on('data', function (msg) {
    worker.send(msg);
  });
}
else if (cluster.isWorker) {
  gu.on('data', function (msg) {
    process.send(msg);
  });
  process.on('message', function(msg) {
    gu.write(msg);
  });
}

And it would need re-starting the worker if it dies. Maybe there's a module that can do process isolated piping like this.

clux added a commit that referenced this issue May 6, 2015
…t bad - promote process isolation for things like this and expose load and unload - for #2
@clux clux changed the title Need a better error handling model Hot reload error model is terrible May 6, 2015
@clux
Copy link
Owner Author

clux commented May 6, 2015

Hot reload removed from gu in 0.6.0. Should properly try out the process isolation stuff in the future, but for now, at least the garbage that was there is gone. Sorry if it was convenient, but it's not the way to do it.

@clux clux changed the title Hot reload error model is terrible Re-implement a working hot reload? Nov 14, 2015
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

No branches or pull requests

1 participant