Skip to content

Conversation

@eoghanmurray
Copy link
Contributor

@eoghanmurray eoghanmurray commented Jun 25, 2020

The 'simple' example seemed to have every possible feature crammed in!

Aside from my conviction that the word 'simple' should really never be used in documentation (if something is simple then why are you documenting it?), my main difficulty here was trying to figure out where async and await are needed on the various statements.
i.e. if I'm just queueing up commands for execution, why do I need to await them? And why do I need to await the call to client.pipeline()? This is all quite verbose and certainly not simple.
Also I emphatically assummed that the with context manager would actually execute the pipeline upon exit, otherwise what is a context manager for?? (yes I've read the source and see that you can reuse a pipeline; I wouldn't have thought to do it this way but would have just created a new pipeline for a new transaction)

Anyhow hopefully this smaller example is correct and will be helpful to future readers of the documentation.

The 'simple' example seemed to have every possible feature crammed in!

Aside from my conviction that the word 'simple' should really never be used in documentation (if something is simple then why are you documenting it?), my main difficulty here was trying to figure out where `async` and `await` are needed on the various statements.
i.e. if I'm just queueing up commands for execution, why do I need to await them?  And why do I need to await the call to `client.pipeline()`?  This is all quite verbose and certainly not simple.
Also I emphatically assummed that the `with` context manager would actually execute the pipeline upon exit, otherwise what is a context manager for??  (yes I've read the source and see that you can reuse a pipeline; I would have just created a new pipeline for a new transaction)

Anyhow hopefully this smaller example is correct and will be helpful to future readers of the documentation.
@NoneGG NoneGG merged commit f19a1bb into NoneGG:master Jul 6, 2020
@eoghanmurray
Copy link
Contributor Author

Has anyone previously also assumed that a with block will call execute at the end of the block?
Would that be a backwards incompatible change?

@Fogapod
Copy link
Contributor

Fogapod commented Aug 14, 2020

@eoghanmurray This can be implemented without breaking changes, calling execute with empty command stack is harmless:

aredis/aredis/pipeline.py

Lines 268 to 269 in cec3cda

if not stack:
return []

I doubt there is a use case where someone intentionally left commands after execute() and expects them to be ignored.

eoghanmurray added a commit to eoghanmurray/aredis that referenced this pull request Aug 19, 2020
@eoghanmurray
Copy link
Contributor Author

@Fogapod I've made a pull request for the auto execute in #168

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