Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@joakimnordling
Copy link
Contributor

This PR fixes the issue that if you were using get_all_subclasses() to gather the models to pass into the async_set_up_composite_indexes_and_ttl_policies() or set_up_composite_indexes_and_ttl_policies() like suggested in the README, like this:

    await async_set_up_composite_indexes_and_ttl_policies(
        gcloud_project="my-project",
        models=get_all_subclasses(AsyncModel),
        client=FirestoreAdminAsyncClient(),
    )

the indexes were created but the TTL policies were not. The get_all_subclasses() method returns an iterator and the underlying set_up_composite_indexes used up the generator so that the call to the set_up_ttl_policies got an empty generator. This fixes it by simply converting it to a list before passing it to each of the underlying functions and updates the test to spot the issue.

@joakimnordling joakimnordling requested review from fbjorn and lietu June 17, 2024 10:36
Copy link
Contributor

@lietu lietu left a comment

Choose a reason for hiding this comment

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

Looks very clear to me

@joakimnordling joakimnordling merged commit 546f0c9 into main Jun 17, 2024
@joakimnordling joakimnordling deleted the hotfix/ttl-policies-from-generators branch June 17, 2024 12:04
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.

3 participants