本文整理匯總了Python中ovs.lib.messaging.MessageController.last_message_id方法的典型用法代碼示例。如果您正苦於以下問題:Python MessageController.last_message_id方法的具體用法?Python MessageController.last_message_id怎麽用?Python MessageController.last_message_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ovs.lib.messaging.MessageController
的用法示例。
在下文中一共展示了MessageController.last_message_id方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: last
# 需要導入模塊: from ovs.lib.messaging import MessageController [as 別名]
# 或者: from ovs.lib.messaging.MessageController import last_message_id [as 別名]
def last(self, pk):
"""
Get the last messageid
"""
try:
_ = int(pk)
except (ValueError, TypeError):
return Response(status=status.HTTP_400_BAD_REQUEST)
return Response(MessageController.last_message_id(), status=status.HTTP_200_OK)
示例2: last
# 需要導入模塊: from ovs.lib.messaging import MessageController [as 別名]
# 或者: from ovs.lib.messaging.MessageController import last_message_id [as 別名]
def last(self, pk):
"""
Get the last messageid
:param pk: Primary key of subscriber
:type pk: int
"""
try:
_ = int(pk)
except (ValueError, TypeError):
return Response(status=status.HTTP_400_BAD_REQUEST)
return Response(MessageController.last_message_id(), status=status.HTTP_200_OK)
示例3: _wait
# 需要導入模塊: from ovs.lib.messaging import MessageController [as 別名]
# 或者: from ovs.lib.messaging.MessageController import last_message_id [as 別名]
def _wait(subscriber_id, message_id):
messages = []
last_message_id = 0
counter = 0
while len(messages) == 0:
messages, last_message_id = MessageController.get_messages(subscriber_id, message_id)
if len(messages) == 0:
counter += 1
if counter >= 120: # 120 * 0.5 seconds = 60 seconds = 1 minute
break
gevent.sleep(.5)
if len(messages) == 0:
last_message_id = MessageController.last_message_id()
MessageController.reset_subscriptions(subscriber_id)
return messages, last_message_id