-
Notifications
You must be signed in to change notification settings - Fork 203
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
Remove Generator
in _quarantine_media_txn()
#17813
Remove Generator
in _quarantine_media_txn()
#17813
Conversation
…e_media_cache table
@realtyem do you have a reference for why providing generators to |
Is a lot of the basis. From that, I distill the TLDR as "Generators may cause inadvertent data loss during a db query retry by exhausting an iterable" |
The comments at spot seem to be relevant. Although this set of PR's may not necessarily be (part of|used by) this infrastructure, still seems prudent to not use generators as a good habit/safety precaution. It may be they end up used in the future, so don't let our tomorrow selves find the foot gun. (And if they do get used in this infrastructure, then is the 'inspection' infrastructure in this function working?) (edit: yes it's working as intended) synapse/synapse/storage/database.py Lines 683 to 695 in 11bc9a1
|
I believe I misunderstood your question, my apologizes. In and of itself, there is no reason I know of why you can not use a However, coming shortly in the future is a bit of a rework for a fair chunk of the database interfacing code and some tightening up of the Typing around it would be a really really good idea. I propose a continuation of work done previously(linked in the issue above, but several links deep into it, I believe). It would make the arguments used for Since that is as simple as a |
This seems fine to do given synapse/synapse/storage/types.py Lines 47 to 49 in 3ae80b0
And the goal is to add proper type hints to |
Context: matrix-org/synapse#15439 (#15439) Also see discussion in #17813
…17890) Use more correct changelog entries for refactoring `Generator` usage - #17813 - #17814 - #17815 - #17816 - #17817 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
when updating the remote_media_cache table
Context: matrix-org/synapse#15439 (#15439)
Pull Request Checklist
(run the linters)