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

Share Redis connection for non-hanging Nucleus Datastore #33

Open
sebastienfilion opened this issue Nov 15, 2018 · 0 comments
Open

Share Redis connection for non-hanging Nucleus Datastore #33

sebastienfilion opened this issue Nov 15, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@sebastienfilion
Copy link
Collaborator

sebastienfilion commented Nov 15, 2018

It would be interesting to attempt to reduce the number of Redis connection in a given controlled ecosystem. If one or many engines are instantiated on the same node process, there is no point of having multiple Redis connection since they are both single threaded.
Hanging connection like those sued to subscribe to Redis commands or events should not share that connection for obvious reason.

class NucleusDatastore {
  constructor (datastoreName = 'Untitled', options = {}) {
    const {
      $logger = console,
      $$server,
      index: datastoreIndex = 0,
      port: datastorePort = 6379,
      URL: datastoreURL = 'localhost'
    } = options;

    this.name = datastoreName;
    this.index = datastoreIndex;

    this.$$handlerCallbackListByChannelName = {};
    this.scriptSHAbyScriptName = {};

    this.$$server = $$server || redis.createClient({
      db: datastoreIndex,
      host: datastoreURL,
      port: datastorePort
    });
  // ...
  }
}
@sebastienfilion sebastienfilion added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant