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

fix: wakunode2 config. adding new 'topic' config parameter. #1727

Merged
merged 2 commits into from
May 12, 2023

Conversation

Ivansete-status
Copy link
Collaborator

Description

Adding a new topic parameter can be repeated.
The topics parameter becomes deprecated because it is not consistent with the other "repeatable" ones as it expects a space-separated list of pubsub topics.

How to use the new parameter

When setting different pubsub topics through the CLI, they can be repeated:
./build/wakunode2 --topic=t1 --topic=t2 --topic=t3 ...

However, when setting them from within a config file, they should be in an array format within the cfg file:

topic = [ "t1" "t2" "t3" ]

Issue

closes #1726

This new parameter can be repeated and we are starting to deprecate the
parameter 'topics', that expected to receive a space-separated list of
pubsubtopic to subscribe to.
let pubsubTopics = conf.topics.split(" ")

var pubsubTopics = @[""]
if conf.topicsDeprecated != "":
Copy link
Member

Choose a reason for hiding this comment

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

How about logging a warning if conf.topicsDeprecated != "" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! I'll add it

Copy link
Contributor

Choose a reason for hiding this comment

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

agree.

if conf.topicsDeprecated != "" and conf.topics.len !=0.
  error

if conf.topicsDeprecated != "":
  warn

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now, if topicsDeprecated is given, it prints a warn. If both topicsDeprecated and topics are given, then an error is returned and the execution is halted.

Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Thanks! After this is merged the next step is to change this across infra repos, make sure we include this in the release notes as an upgrade instruction and then remove the deprecated option.

Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

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

thanks for this, left a comment which i think its important, otherwise we will be introducing breaking changes.

and out of curiosity, why from file its like this? i find it confusing that the behaviour is different. cant we have the same? topic=a, topic=b?
topic = [ "t1" "t2" "t3" ]

mind having a look on how staticnode(s) is implemented?

defaultValue: "/waku/2/default-waku/proto"
topicsDeprecated* {.
desc: "Default topics to subscribe to (space separated list). DEPRECATED: please use repeated --topic argument instead."
defaultValue: ""
Copy link
Contributor

@alrevuelta alrevuelta May 12, 2023

Choose a reason for hiding this comment

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

should we keep the /waku/2/default-waku/proto here? otherwise old deployments using "topics" will break? (meaning they will no longer be subscribed)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh! Important point that I missed. @alrevuelta is right here. I think we should keep the default in both config options.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It shouldn't break because if nothing is specified, the default pubsub topic will get used.

Copy link
Contributor

Choose a reason for hiding this comment

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

you are right:

pubsubTopics = conf.topics

but perhaps a bit convoluted? can see you applied the changes thanks!

@Ivansete-status
Copy link
Collaborator Author

Ivansete-status commented May 12, 2023

thanks for this, left a comment which i think its important, otherwise we will be introducing breaking changes.

and out of curiosity, why from file its like this? i find it confusing that the behaviour is different. cant we have the same? topic=a, topic=b? topic = [ "t1" "t2" "t3" ]

mind having a look on how staticnode(s) is implemented?

This behavior comes from 'confutils'. It behaves equally for any other repeatable parameter, i.e. staticnodes.

I absolutely agree that it is confusing.

Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

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

now lgtm thanks!

@Ivansete-status Ivansete-status merged commit 2ec9809 into master May 12, 2023
@Ivansete-status Ivansete-status deleted the bug-1726-topic-flags branch May 12, 2023 11:37
Ivansete-status added a commit to Ivansete-status/infra-role-nim-waku that referenced this pull request May 30, 2023
This change is interesting due to the deprecation of the 'topics'
parameter.

waku-org/nwaku#1727
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.

bug: inconsistent usage of topic flags
4 participants