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

Fix hang when trying to use Client after close #107

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

gtopper
Copy link
Member

@gtopper gtopper commented Apr 18, 2023

No description provided.

@tomerm-iguazio
Copy link
Contributor

tomerm-iguazio commented Apr 18, 2023

I can not mark this lines because they remained unchanged, but please look at self._free_connections.put
inside these function:

wait_response (appear twice)

I think I will do it differently:

Instead of manually preventing it from each function and changing attribute type, I will create a class called CloseableQueue that inherit from Queue class.

The class will have a bool attribute called active.

In this way you can override default Queue.get/put and preventing it from running if active = False.

You can also dynamically raise an error from the calling method by using inspect:
def get(self,*args,**kwargs): if not self.active: raise RuntimeError(f"Cannot use get on a closed queue")

In this way, you will not need to manually check if the connections are not closed for each function before using self._free_connections.

@gtopper gtopper merged commit c8b37c2 into v3io:development Apr 18, 2023
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