Skip to content

2.6 refinement/explanation #321

Closed
Closed
@anthonyvdotbe

Description

@anthonyvdotbe

§2.6 says:

A Subscriber MUST call Subscription.cancel() if it is no longer valid to the Publisher without the Publisher having signaled onError or onComplete.

To me, it's unclear what it means for a Subscriber to be "valid to the Publisher". This was explained by @viktorklang as:

If the "downstream" completes or errors before the "upstream". Imagine for instance a Processor which only wants the first element from its "upstream". Or a Subscriber which receives a "forbidden" value. etc.

which makes sense, but I don't get that from reading the rule. I believe there are 2 issues:

  • the word "valid": I don't see why, for example, a Processor which only wants the first element from its "upstream" would be any more valid/invalid than a Processor who wants all elements
  • the phrase "to the Publisher": this implies to me that there's a validity relation with the Publisher (i.e. a Subscriber can be in a state of "valid, but invalid to its Publisher")

For reference, the current wording was introduced in ec7c3bd, where it previously was:

A Subscriber MUST call Subscription.cancel() during shutdown if it still has an active Subscription.

Hereby, I want to propose the following:

A Subscriber MUST call Subscription.cancel() if it no longer has an interest in receiving signals from its Publisher and the Subscription is not considered cancelled yet.

Note that this also rephrases the last part of the rule, saying and the Subscription is not considered cancelled yet instead of without the Publisher having signaled onError or onComplete. The former is slightly more general, as there may be other conditions under which a Subscriber must consider its Subscription cancelled.

The explanation of the rule would then give concrete examples of cases where the Subscriber would no longer have such an interest (such as those given by @viktorklang above). And it would reference §2.4 as an example of when a Subscription is considered cancelled.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions