beanie icon indicating copy to clipboard operation
beanie copied to clipboard

Add auto_index option

Open grimmer0125 opened this issue 2 years ago • 0 comments

Actually, this PR is to solve one issue that using multiple beanie clients in "forked" multi-process often hang on init_beanie. That deeper part is it would hang on old_indexes = (await collection.index_information()).keys(). I think it is an issue on pymongo side and https://pymongo.readthedocs.io/en/stable/faq.html#is-pymongo-fork-safe indicates it will be safe if instantiating a new pymongo client but I guess it still may have some potential issues, even doing so, just like this issue I met. If I have time, I may open a issue on pymongo repo.

So this is to skip the auto index part code. It may be still valuable that sometimes you can turn off this auto_index, like in production, or anytime. mongoengine mentioned by @snjypl in discord, and JavaScript famous mongoose both have this option.

grimmer0125 avatar Nov 24 '21 17:11 grimmer0125