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: read all chunks in queue since we have interval in listener #337

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

hfudev
Copy link
Member

@hfudev hfudev commented Jan 22, 2025

related to #334

@hfudev hfudev requested a review from horw January 22, 2025 12:00
@hfudev hfudev self-assigned this Jan 22, 2025
@@ -42,6 +44,10 @@ def put(self, obj, **kwargs):
except: # noqa # queue might be closed
pass

def get_all(self) -> List[bytes]:
with self.lock:
return [self.get() for _ in range(self.qsize())]
Copy link
Member

@horw horw Jan 23, 2025

Choose a reason for hiding this comment

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

I have not tried it at Mac, but there is a comment in the code.

    def qsize(self):
        # Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
        return self._maxsize - self._sem._semlock._get_value()
        

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

nice point. i'll use the try except get then

@hfudev hfudev force-pushed the fix/get-queue-blocked branch from 21dfc95 to 748ac58 Compare January 23, 2025 15:09
@hfudev hfudev merged commit 8a64648 into main Jan 24, 2025
4 of 5 checks passed
@hfudev hfudev deleted the fix/get-queue-blocked branch January 24, 2025 12:57
@erhankur
Copy link
Contributor

@hfudev Thank you for looking into this. My original issue still exists, but at least the 100ms sleep effect will be resolved.

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