-
-
Save raybotha/c7f193fce0a2c06418f03defe4a33687 to your computer and use it in GitHub Desktop.
Greenthread pubsub debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventlet | |
eventlet.monkey_patch() | |
from google.cloud import pubsub_v1 | |
from time import sleep | |
publisher = pubsub_v1.PublisherClient() | |
topic_path = publisher.topic_path("project1234", "topic1234") | |
def run(): | |
for i in range(1000): | |
publisher.publish(topic_path, data=str(i).encode("utf-8")) | |
sleep(1) | |
print("heyo") | |
thread = eventlet.greenthread.spawn(run) | |
thread.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment