google cloud pubsub - Pull extremely slow when no messages on queue -
i using pubsub gmail push notifications.
the pubsub subscription recieves messages expected.
when pull messages have noticed if there no messages pull delay in getting response slow.
if there @ least 1 message pull response timely
has else experienced this?
the fix can come leave message on queue.
if (credential.requestaccesstokenasync(cancellationtoken.none).result) { var pubsubserivce = new google.apis.pubsub.v1beta2.pubsubservice( new baseclientservice.initializer() { httpclientinitializer = credential, applicationname = "ilink", }); pullrequest pr = new pullrequest(); pr.maxmessages = 100; pullresponse prs = pubsubserivce.projects.subscriptions.pull(pr, "projects/vivid-canyon-90023/subscriptions/ilink").execute(); acknowledgerequest ak = new acknowledgerequest(); if (prs != null && prs.receivedmessages != null) { ak.ackids = new list<string>(); string messagetext = ""; foreach (receivedmessage rm in prs.receivedmessages) { ak.ackids.add(rm.ackid); messagetext += " | " + rm.message.data; } pubsubserivce.projects.subscriptions.acknowledge(ak, "projects/vivid-canyon-90023/subscriptions/ilink").execute(); master.setsuccessprompt("pulled total meesage count of: " + prs.receivedmessages.count + " | data | " + messagetext); } else { master.setsuccessprompt("no messages pull"); } }
this not slow, hanging , waiting messages. try using returnimmediately=true.
Comments
Post a Comment