Skip to content

Conversation

@mjsir911
Copy link

This is all kind of assuming that there can only be one pid registered to a name, but I think that's correct?

doesn't add a named process receive_forever test but I can add that in as well pretty easily.

@mjsir911
Copy link
Author

mjsir911 commented Sep 23, 2025

this currently doesn't handle the possibility of:

  1. main process is registered to a name
  2. main process gets sent some data
  3. the name gets re-registered to a different process
  4. the main process then tries receive()ing on the named subject, to get the data that's existed on the mailbox
  5. previous behavior: would succeed, and allow any number of receive()s on names that the process is not registered to.
    current behavior: fails because the process is not registered to the name, even if there is some data for it in the mailbox. maybe this warrants a receive_unchecked()?

@lpil
Copy link
Member

lpil commented Sep 25, 2025

Hello!

That's an interesting point about messages in the inbox from a previously registered name. I wonder what would be best to do about that.

@mjsir911
Copy link
Author

mjsir911 commented Sep 25, 2025

That's an interesting point about messages in the inbox from a previously registered name. I wonder what would be best to do about that.

maybe just verify that the subject is owned by the current process on subject creation, store it within the namedsubject & then assume it's receivable on?

could also just give out a warning? or something? if receive is run on a non-owned named subject

@lpil
Copy link
Member

lpil commented Sep 27, 2025

That would mean that only the subject owner could make the subject, which would defeat the purpose of names!

How about we document that a selector can be used if they want to avoid this check.

@mjsir911 mjsir911 force-pushed the m/err_receive_better branch from 7282e20 to 54f93ee Compare October 20, 2025 15:20
/// *previously* registered to this process, and then got re-registered
/// to another.
/// To recieve messages on subjects not directed at the current pid,
/// use `Select`
Copy link
Member

Choose a reason for hiding this comment

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

Correct grammar and punctuation in documentation please 🙏

It doesn't return an error in this case, and there is no thing called Select.

Perhaps something like this:

You may wish to use named subject that was previously owned by the current process, in order to select messages that were received and still reside in the process mailbox. In this case you can use the select and selector_receive functions instead.

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