-
Notifications
You must be signed in to change notification settings - Fork 336
Conversation
13ffb1c
to
ffd32f7
Compare
fda28de
to
d031d4c
Compare
Current coverage is 96.48% (diff: 85.53%)@@ master #129 diff @@
==========================================
Files 51 50 -1
Lines 6160 6267 +107
Methods 0 0
Messages 0 0
Branches 465 481 +16
==========================================
+ Hits 5974 6047 +73
- Misses 141 166 +25
- Partials 45 54 +9
|
Do you think it is possible (or makes sense) to make the initialization of the Client/Pool synchronous like in https://github.com/aio-libs/aiomcache#getting-started This way we could avoid patterns like this one where all the functions need to connect to the pool before doing its operation. |
I think aiomcache has a error in design. Let's consider the following code:
What's wrong with it? Hint: think about testing for example. |
From a user perspective I prefer this: https://github.com/argaen/aiocache/blob/master/aiocache/backends/memcached.py#L11 than having to have something like https://github.com/argaen/aiocache/blob/master/aiocache/backends/redis.py#L120 and then call it for every method that needs to interact with redis... Also from testing for me its easier to do:
Than having to patch the |
@argaen what you really need is In my snippet I mean not mocking but working with read memcache server in functional tests.
but overriding all instances which has grabbed event loop too early is very tedious and error prone. |
Yes, It is possible — you can instatiate RedisPool directly but it is kind of private API;
No, as this would lead to late errors, i.e. if redis server is unreachable connection errors would |
377d56e
to
e17b7a4
Compare
712e67c
to
3e13ab9
Compare
5c937ac
to
ac6c987
Compare
8b78a86
to
6281326
Compare
6281326
to
d0d25db
Compare
This changes are intended to invert pool-to-redis dependency; Redis will be top-level API working
either with pool, or a single connection.
Sub tasks:
address
to Connection;