Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Immutable locking config#189

Merged
seba-aln merged 5 commits intomasterpubnub/python:masterfrom
feat/immutable-pnconfigurationpubnub/python:feat/immutable-pnconfigurationCopy head branch name to clipboard
Aug 8, 2024
Merged

Immutable locking config#189
seba-aln merged 5 commits intomasterpubnub/python:masterfrom
feat/immutable-pnconfigurationpubnub/python:feat/immutable-pnconfigurationCopy head branch name to clipboard

Conversation

@seba-aln
Copy link

@seba-aln seba-aln commented Jul 30, 2024

feat: Optionally immutable config.

Option to lock PNConfiguration mutability. Note that mutable config will be deprecated in future major releases

@seba-aln seba-aln marked this pull request as ready for review August 1, 2024 08:11
self.config = config
def __init__(self, config: PNConfiguration):
if not config.disable_config_locking:
config.lock()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if, as a user, I wanted to reuse most of the settings of the config to create a new (second) PN instance, is there a way I can do it now? probably not, since the original config will be locked (both outside and the inner copy in PN)?

Can you add a method to config that, even with a locked config, lets me clone+modify an existing config? or is it already possible with some Python magic, or similar to the deepcopy function that you're using here

I'd like to do something like (pseudocode):

val config = PNConfiguration(blah, blah, blah)
val pubnub1 = PubNub(config)

val config2 = config.copy(uuid = blah2)
val pubnub2 = PubNub(config2)

@seba-aln seba-aln force-pushed the feat/immutable-pnconfiguration branch from 2a20d99 to e97e0f6 Compare August 6, 2024 12:48
@seba-aln seba-aln merged commit b56d703 into master Aug 8, 2024
@seba-aln seba-aln deleted the feat/immutable-pnconfiguration branch August 8, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.