Skip to content

Share Redis connection for non-hanging Nucleus Datastore #33

@sebastienfilion

Description

@sebastienfilion

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
    });
  // ...
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions