Skip to content

2nd call to set_config reopens the client without reopening the streaming connection #218

@tsiq-clemens

Description

@tsiq-clemens

Describe the bug
In our code, we accidentally called a code segment twice when our web service initiates, which effectively calls set_config() twice.

ldclient.set_config(Config(config.sdk_key))
self.ldclient = ldclient.get()

What happens is that set_config() notices that a client already exists, so it prints "reinitializing", then closes the client and opens another. However, no updates to any LD flags make it to the client, it seems like there is no longer a streaming connection.

Our fix was to not run the segment above 2x, and then any updates from the LD UI make it to the server as expected.
I am aware that one should not call set_config twice, but when you do so (accidentally) its behavior is at best confusing as a client exists and works but gets no live updates anymore.

To reproduce
Call set_config() twice, followed by the singleton .get(); make a change to a flag in the LD UI and validate that the client is not aware of it.

Expected behavior
set_config() closes an existing client and opens another. I would expect the new client to reopen/maintain the streaming updates to the LD server.

SDK version
7.6.1

Language version, developer tools
python 3.9

OS/platform
Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalewaiting for feedbackIndicates LaunchDarkly is waiting for customer feedback before issue is closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions