Skip to content

Instantly share code, notes, and snippets.

@raybotha

raybotha/gt.py Secret

Last active March 15, 2018 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raybotha/c7f193fce0a2c06418f03defe4a33687 to your computer and use it in GitHub Desktop.
Save raybotha/c7f193fce0a2c06418f03defe4a33687 to your computer and use it in GitHub Desktop.
Greenthread pubsub debug
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