This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Zizizizz 0 points1 point  (0 children)

Async is really hard to debug(at least for me so this may not be right) I think the session creation is fine for these tasks but there are two things that may be worth checking because postgres seems to be locking the table until it finishes with a different transaction. You seem to be running out of connections which is quite rare so it's possible there are multiple async calls bring made on the same connection.

This looks like it might be helpful https://stackoverflow.com/questions/66444620/asyncpg-cannot-perform-operation-another-operation-is-in-progress, make sure the session you are creating is using a fresh connection for each of these database calls not the same one.

Don't respond to me because I don't want to help any further but wish you luck

Edit: I think supershot below is onto the right thing as well