Skip to content

Convert EventInternalMetadata to use Arc<RwLock<_>>#19669

Merged
erikjohnston merged 6 commits intodevelopfrom
erikj/internal_metadata_arc
Apr 16, 2026
Merged

Convert EventInternalMetadata to use Arc<RwLock<_>>#19669
erikjohnston merged 6 commits intodevelopfrom
erikj/internal_metadata_arc

Conversation

@erikjohnston
Copy link
Copy Markdown
Member

This moves the reference counting from PyO3 into standard Rust types, allowing the class to be used natively from Rust without needing a Python runtime.

This moves the reference counting from PyO3 into standard Rust types,
allowing the class to be used natively from Rust without needing a
Python runtime.
@erikjohnston erikjohnston marked this pull request as ready for review April 8, 2026 13:00
@erikjohnston erikjohnston requested a review from a team as a code owner April 8, 2026 13:00
@reivilibre reivilibre self-requested a review April 15, 2026 12:44
Copy link
Copy Markdown
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

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

I think this is fine, albeit boilerplatey, though we can think about that later if we do more and more of these. (Maybe the next steps will present some clearer opportunities to simplify things)

Comment thread rust/src/events/internal_metadata.rs
Ok(Some(entry)) => data.push(entry),
Ok(None) => {}
Err(err) => {
warn!("Ignoring internal metadata field '{key}', as failed to convert to Rust due to {err}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think error! might be more appropriate here; if this happens something is pretty wrong?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There are some old events with internal metadata fields that we no longer use, so I don't really want to error here as its not actually a problem really.

@erikjohnston
Copy link
Copy Markdown
Member Author

I think this is fine, albeit boilerplatey, though we can think about that later if we do more and more of these. (Maybe the next steps will present some clearer opportunities to simplify things)

Yeah, not really sure what to do with the boilerplate. FWIW pyo3 recommends this approach rather than relying on its primitives to do mutability.

Comment thread changelog.d/19669.misc Outdated
@erikjohnston erikjohnston merged commit 2d015f7 into develop Apr 16, 2026
44 of 46 checks passed
@erikjohnston erikjohnston deleted the erikj/internal_metadata_arc branch April 16, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants