Skip to content

Cluster does not work on Galaxy #111

Open
@guns2410

Description

@guns2410

I have observed that meteorhacks:cluster does not work on galaxy dev edition (and also with the production version). I have an application running 7 different micro-services powering a single application. I have been working on making the servers talk to each other over DDP using cluster and it was preety easy on AWS and Digital Ocean.

I wish apart from Loadbalancing, Cluster could be used on Galaxy for DDP connections.

DDPConnector = function (url, options = {}) {
    this.url = url;
    this.ddpOptions = options.ddpOptions || {};
    this.timeout = options.timeout || 5 * 1000;

    this.connection = DDP.connect(this.url, this.ddpOptions);
    this.connection.disconnect();
    this.startConnecting();
}

DDPConnector.prototype.getConnection = function () {
    return this.connection;
}

DDPConnector.prototype.getUrl = function () {
    return this.url;
}

DDPConnector.prototype.startConnecting = function () {
    var self = this;
    var connected = false;
    setConnectionIfNeeded();

    this.timeoutHandler = Meteor.setInterval(setConnectionIfNeeded, self.timeout);

    function setConnectionIfNeeded () {
        var status = self.connection.status();
        var isOffline = connected && status.status == "offline";
        if (!status.connected && !isOffline) {
            self.connection.reconnect({ url: self.url });
            connected = true;
        }
    }
}

DDPConnector.prototype.stop = function () {
    Meteor.clearTimeout(this.timeoutHandler);
}

This is what i have incorporated temporarily removing Cluster. I know this code would be buggy but i really hope that we have meteorhacks:cluster work on Galaxy..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions