Skip to content

Slightly more efficient and simplified metadata update method #935

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

Merged
merged 3 commits into from
Jul 21, 2025

Conversation

nonprofittechy
Copy link
Member

This doesn't seem to have a huge impact, but it might shave about 0.02s from a typical page load?

I tested this on the test_question_library.yml file and that's the difference I was seeing.

Completed processing at 0.15401s the old way, vs 0.13143s the new way. I probably didn't do enough passes to be positive, but I like the API a bit better anyway. It's not likely to be a huge impact either way.

This is part of the solution to #773 . Want to test @jpagh's idea also. But this seems safe and helpful.

@nonprofittechy nonprofittechy marked this pull request as ready for review July 11, 2025 22:31
Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a comment

Choose a reason for hiding this comment

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

LGTM! Not the most knowledgable about Postgres Jsonb, but it checks out from what I can tell.

I don't think that the speed up is really worth it, but I think having a better API for updating session metadata is good, same with getting rid of the extra tmp var we needed to delete in interviews.

Agree that a slight race condition is fine for this feature, session metadata doesn't need to be exactly in sync with on every page.

@BryceStevenWilley
Copy link
Contributor

Also okay with merging as is, even with the failing test; it's failing because tests hadn't been running on this repo for a while; seems to be an issue with unittest mocking, but I wasn't able to figure out exactly what's wrong or how to fix it.

@nonprofittechy nonprofittechy merged commit 6ab7dd5 into main Jul 21, 2025
4 of 5 checks passed
@nonprofittechy nonprofittechy deleted the 773-more-efficient-metadata branch July 21, 2025 15:22
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