-
Notifications
You must be signed in to change notification settings - Fork 214
Closed
Labels
🚨This issue needs some love.This issue needs some love.api: pubsubIssues related to the googleapis/python-pubsub API.Issues related to the googleapis/python-pubsub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Each time a public request is made, the memory in the pod of Kubernetes increases. Removing the publishing part does not increase memory.
The pod is continuously restarted due to OOM.
Environment details
- OS type and version: Debian GNU/Linux 10
- Python version: 3.8.7
- pip version: 21.0.1
google-cloud-pubsubversion: 2.4.1
Code example
class PublishToPubsubCallback(Callback):
def __init__(self, pod_name, project_id, topic_id, preprocess=[]):
super(PublishToPubsubCallback, self).__init__(pod_name, preprocess=preprocess)
self.project_id = project_id
self.topic_id = topic_id
self.publisher = pubsub_v1.PublisherClient()
self.topic_path = self.publisher.topic_path(project_id, topic_id)
def __call__(self, data):
pub_data = json.dumps(data).encode('utf-8')
self.publisher.publish(self.topic_path, pub_data)
callback = PublishToPubsubCallback(pod_name, project_id, topic_id)
async def run():
while True:
data = await watch_websocket_data()
callback(data)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: pubsubIssues related to the googleapis/python-pubsub API.Issues related to the googleapis/python-pubsub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
