Nothing Special   »   [go: up one dir, main page]

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

Stop calling deprecated Connection functions push_connection, pop_connection, resolve_connection, parse_connection #1949

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

PrenSJ2
Copy link
@PrenSJ2 PrenSJ2 commented Jun 15, 2023

Fix #1948

connection is called explicitly whilst retaining backwards compatibility with push_connection
@PrenSJ2
Copy link
Author
PrenSJ2 commented Jun 15, 2023

if

   if redis is None:
      redis = Redis()
  push_connection(redis)

is equal to

Queue(connection=redis)

need to 🤔 think of how I can apply this to Connection's methods [push_connection, pop_connection, resolve_connection, parse_connection]

@PrenSJ2 PrenSJ2 changed the title Stop calling deprecated function push_connection Stop calling deprecated Connection functions push_connection, pop_connection, resolve_connection, `parse_connection Jun 16, 2023
not sure if this is the best way to replace connection but lmk
@PrenSJ2
Copy link
Author
PrenSJ2 commented Jun 16, 2023

@ccrvlh I see you added the deprecation comments a while ago, I am trying to solve this issue however there is nothing clear in the docs or your PR to suggest how we should use connection explicitly instead of the Connection functions, any comments or suggestions would be greatly appreciated.

@PrenSJ2 PrenSJ2 changed the title Stop calling deprecated Connection functions push_connection, pop_connection, resolve_connection, `parse_connection Stop calling deprecated Connection functions push_connection, pop_connection, resolve_connection, parse_connection Jun 16, 2023
@ccrvlh
Copy link
Collaborator
ccrvlh commented Jun 16, 2023

Hi @PrenSJ2.

In the PR #1860 there's a description about what was done:

Most of the functions on the connections module are used to interact with a Redis connection implicitly through the LocalStack: push/pop/use/resolve_connection.

The connection ideally should be handled explicitly and the with Connection already has a deprecation warning. This adds deprecation warnings to those functions. After these are deprecated, we would be able to delete the local.py entirely, and only handle connections explicitly.

The docs also discuss ways of handling connections here. When we worked on that PR, the connection context_manager was already deprecated, and explicit connection handling (passing the connection as an argument to the Queue and other objects) was already being suggested in the docs for a while.

It would probably make sense to also add a deprecation warning to the docs, and slowly refactor the internals to use the explicit connection handling pattern everywhere (mostly the tests if I remember correctly).

need to 🤔 think of how I can apply this to Connection's methods [push_connection, pop_connection, resolve_connection, parse_connection]

I don't remember the details and every case where the connection is being pushed/popped but ideally you won't do anything with those methods. If you're explicitly handling connection, they shouldn't be necessary anymore (those are all there for the "implicit" connection handling).

Unfortunately I haven't been having much time to work here (hopefully that will change in the future), but let me know if you have any doubts, I'll try to help as I can.

@selwin
Copy link
Collaborator
selwin commented Jun 17, 2023

I don't think we should change this behavior until version 2.0, where use_connection will be fully deprecated. Mind changing the PR so that we simply stop using push_connection in our testcases?

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.

perform_job calls push_connection which is a deprecated function
3 participants