sopherapps / pydantic-redis

A simple Declarative ORM for Redis using pydantic Models
https://sopherapps.github.io/pydantic-redis
MIT License
39 stars 14 forks source link

Passing a redis client to the redis_store Store init param has no effect #23

Closed mheguy-stingray closed 1 year ago

mheguy-stingray commented 1 year ago

The redis_store provided to init is overwritten by the class creating its own connection:

    def __init__(
        self,
        ...
        redis_config: RedisConfig,
        redis_store: Optional[Union[Redis, AioRedis]] = None,
        ...
    ):
        super().__init__(
            ...
            redis_store=redis_store,
            ...
        )

        self.redis_store = self._connect_to_redis()
mheguy-stingray commented 1 year ago

I tried passing my own redit store but I get a "loop already closed" error from asyncio. So clearly there's something about this I don't grok. Closing for now.