Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple cursors support #801

Merged
merged 3 commits into from
Mar 22, 2021
Merged

Conversation

Pliner
Copy link
Member

@Pliner Pliner commented Mar 21, 2021

What do these changes do?

Support of multiple cursors which was initially proposed in #548 to resolve #535 and #364 by @vir-mir. I've slightly modified the implementation and rebased on top of master.

Are there changes in behavior for the user?

Related issue number

#777, #535, #364, #548, #778

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

Sorry, something went wrong.

@codecov
Copy link

codecov bot commented Mar 21, 2021

Codecov Report

Merging #801 (49824c3) into master (2e6e0f5) will increase coverage by 0.24%.
The diff coverage is 94.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #801      +/-   ##
==========================================
+ Coverage   93.20%   93.45%   +0.24%     
==========================================
  Files          13       13              
  Lines        1545     1542       -3     
  Branches      176      178       +2     
==========================================
+ Hits         1440     1441       +1     
+ Misses         76       72       -4     
  Partials       29       29              
Impacted Files Coverage Δ
aiopg/sa/result.py 91.26% <62.50%> (-0.45%) ⬇️
aiopg/utils.py 85.61% <84.61%> (+3.61%) ⬆️
aiopg/sa/connection.py 87.30% <96.15%> (+0.97%) ⬆️
aiopg/connection.py 91.36% <100.00%> (-0.47%) ⬇️
aiopg/pool.py 100.00% <100.00%> (ø)
aiopg/sa/engine.py 100.00% <100.00%> (ø)
aiopg/sa/transaction.py 84.81% <100.00%> (+0.81%) ⬆️
aiopg/transaction.py 100.00% <100.00%> (ø)
aiopg/cursor.py 99.40% <0.00%> (-0.60%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e6e0f5...49824c3. Read the comment docs.

@lgtm-com
Copy link

lgtm-com bot commented Mar 21, 2021

This pull request fixes 1 alert when merging 48cde02 into 65ca604 - view on LGTM.com

fixed alerts:

  • 1 for Wrong number of arguments in a call

@lgtm-com
Copy link

lgtm-com bot commented Mar 21, 2021

This pull request fixes 4 alerts when merging e11c6fb into 65ca604 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@@ -43,7 +43,7 @@ def __init__(self, dsn, minsize, maxsize, timeout, *,
raise ValueError("maxsize should be not less than minsize")
self._dsn = dsn
self._minsize = minsize
self._loop = get_running_loop(kwargs.pop('loop', None) is not None)
Copy link
Member Author

Choose a reason for hiding this comment

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

I suppose we are ready to drop this

finally:
self._engine = None
self._conn = None
asyncio.ensure_future(self._conn.close(), loop=self._loop)
Copy link
Member Author

Choose a reason for hiding this comment

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

close is coroutine, so we have to await it somehow

self._obj = None
try:
if asyncio.iscoroutinefunction(self._obj.close):
await self._obj.close()
Copy link
Member Author

Choose a reason for hiding this comment

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

obj.close could be a coroutine, for instance, in case of Engine.acquire.

@lgtm-com
Copy link

lgtm-com bot commented Mar 21, 2021

This pull request fixes 4 alerts when merging 5c4f92e into 65ca604 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@lgtm-com
Copy link

lgtm-com bot commented Mar 22, 2021

This pull request fixes 4 alerts when merging 6b2db0c into 59671d3 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@lgtm-com
Copy link

lgtm-com bot commented Mar 22, 2021

This pull request fixes 4 alerts when merging 164a47c into 59671d3 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@Pliner Pliner changed the title Multiple cursors support and fix of rollback for closed connection Multiple cursors support Mar 22, 2021
@Pliner Pliner force-pushed the multiple-cursors-and-rollback-fixes branch from 164a47c to b804c88 Compare March 22, 2021 09:53
@Pliner Pliner force-pushed the multiple-cursors-and-rollback-fixes branch from b804c88 to 774fd83 Compare March 22, 2021 09:56
@Pliner Pliner marked this pull request as ready for review March 22, 2021 09:57
@lgtm-com
Copy link

lgtm-com bot commented Mar 22, 2021

This pull request fixes 4 alerts when merging 774fd83 into 2e6e0f5 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@lgtm-com
Copy link

lgtm-com bot commented Mar 22, 2021

This pull request fixes 4 alerts when merging f44009b into 2e6e0f5 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@lgtm-com
Copy link

lgtm-com bot commented Mar 22, 2021

This pull request fixes 4 alerts when merging 49824c3 into 2e6e0f5 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`
  • 1 for Unnecessary 'else' clause in loop
  • 1 for Module is imported with 'import' and 'import from'
  • 1 for Wrong number of arguments in a call

@Pliner Pliner merged commit c71e17b into master Mar 22, 2021
@Pliner Pliner deleted the multiple-cursors-and-rollback-fixes branch March 22, 2021 10:49
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.

Inner async for loop caused cursor already closed error
1 participant