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

Make drop notification timing for plugin custom values more consistent #12341

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

devyn
Copy link
Contributor

@devyn devyn commented Mar 31, 2024

Description

This keeps plugin custom values that have requested drop notification around during the lifetime of a plugin call / stream by sending them to a channel that gets persisted during the lifetime of the call.

Before this change, it was very likely that the drop notification would be sent before the plugin ever had a chance to handle the value it received.

Tests have been added to make sure this works - see the custom_values plugin.

cc @ayax79

User-Facing Changes

This is basically just a bugfix, just a slightly big one.

However, I did add an as_mut_any() function for custom values, to avoid having to clone them. This is a breaking change.

Tests + Formatting

  • 🟢 toolkit fmt
  • 🟢 toolkit clippy
  • 🟢 toolkit test
  • 🟢 toolkit test stdlib

This keeps plugin custom values that have requested drop notification
around during the lifetime of a plugin call / stream by sending them to
a channel that gets persisted during the lifetime of the call.

Before this change, it was very likely that the drop notification would
be sent before the plugin ever had a chance to handle the value it
received.

Tests have been added to make sure this works - see the `custom_values`
plugin.
@devyn
Copy link
Contributor Author

devyn commented Apr 3, 2024

I believe this is good to merge for the point release. The existing plugin tests are pretty extensive and this only affects one feature that's not really used by anyone except @ayax79 yet

@sholderbach sholderbach merged commit cbf7fee into nushell:main Apr 4, 2024
15 checks passed
@devyn devyn deleted the custom-value-drop-timing branch April 4, 2024 07:51
@hustcer hustcer added this to the v0.93.0 milestone Apr 4, 2024
@devyn
Copy link
Contributor Author

devyn commented Apr 4, 2024

@hustcer I believe this should go out with 0.92.1

@hustcer
Copy link
Contributor

hustcer commented Apr 4, 2024

@hustcer I believe this should go out with 0.92.1

Never mind, as we don't have a milestone for 0.92.1, and it won't stop us from shipping a patch release. what's more, I think it should be included in the 0.93.0 release note.

@devyn
Copy link
Contributor Author

devyn commented Apr 4, 2024

Ah, okay, makes sense

@fdncred fdncred added the pr:plugins This PR is related to plugins label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:plugins This PR is related to plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants