def pollBackendAvailability( isOneOff = True ):
global IS_BACKEND_AVAILABLE
aid = AgentId( '0.0.0.0.0' )
aid.org_id = ADMIN_OID
res = model.request( 'list_sensors', { 'aid' : aid }, timeout = 2 )
res2 = identmanager.request( 'get_org_info', { 'include_all' : True } )
if res.isSuccess and res2.isSuccess:
IS_BACKEND_AVAILABLE = True
print( 'Backend available' )
if not isOneOff:
gevent.spawn_later( 10, pollBackendAvailability, isOneOff = False )
else:
IS_BACKEND_AVAILABLE = False
print( 'Backend unavailable' )
if not isOneOff:
gevent.spawn_later( 2, pollBackendAvailability, isOneOff = False )
评论列表
文章目录