Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
This repository was archived by the owner on May 30, 2024. It is now read-only.

Multiple client instances #127

@amacar

Description

@amacar

Hi,

I am trying to init multiple clients at the same time, but it looks like that only first initialized client works.
Is this behavior supported or what is your proposed solution?

Here is a function that identifies a user and adds it to the segment. The user is only created using the first client, for the second call though user is never created.
Code:

const identifyUser = async (sdkKey, user, segmentUrl, envName, segmentKey, body) => {
  const client = LaunchDarkly.init(sdkKey, { flushInterval: 1 });
  await client.waitForInitialization();
  client.identify(user);
  await client.flush();
  await launchDarklyAxios.patch(`${segmentUrl + envName}/${segmentKey}`, body);
  client.close();
};

await identifyUser(envKeys[0].sdkKey, user, segmentUrl, envKeys[0].name, segmentKey, body);
await identifyUser(envKeys[1].sdkKey, user, segmentUrl, envKeys[1].name, segmentKey, body);

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