-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Labels
api: pubsubIssues related to the googleapis/python-pubsub API.Issues related to the googleapis/python-pubsub API.type: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.
Description
Looks like message arg is never used by will_accept() method:
python-pubsub/google/cloud/pubsub_v1/publisher/_batch/base.py
Lines 112 to 136 in cf9e87c
| def will_accept(self, message): | |
| """Return True if the batch is able to accept the message. | |
| In concurrent implementations, the attributes on the current batch | |
| may be modified by other workers. With this in mind, the caller will | |
| likely want to hold a lock that will make sure the state remains | |
| the same after the "will accept?" question is answered. | |
| Args: | |
| message (~.pubsub_v1.types.PubsubMessage): The Pub/Sub message. | |
| Returns: | |
| bool: Whether this batch can accept the message. | |
| """ | |
| # If this batch is not accepting messages generally, return False. | |
| if self.status != BatchStatus.ACCEPTING_MESSAGES: | |
| return False | |
| # If this message will make the batch exceed the ``max_messages`` | |
| # setting, return False. | |
| if len(self.messages) >= self.settings.max_messages: | |
| return False | |
| # Okay, everything is good. | |
| return True |
Most likely it should be deleted to avoid any confusion, but I suppose it should be done with deprecation. Batch() is not something pretending to be manually used by users, but who knows.
@pradn, please, comment
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the googleapis/python-pubsub API.Issues related to the googleapis/python-pubsub API.type: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.