Looks like message arg is never used by will_accept() method:
|
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
Reactions are currently unavailable
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
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