Skip to content

Commit

Permalink
Added cell.isCellActive() API
Browse files Browse the repository at this point in the history
  • Loading branch information
invisig0th committed Dec 26, 2020
1 parent d3ca483 commit f159bd4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions synapse/lib/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ def getCellType(self):
def getCellIden(self):
return self.cell.getCellIden()

async def isCellActive(self):
'''
Returns True if the cell is an active/leader cell.
'''
return await self.cell.isCellActive()

@adminapi()
def getNexsIndx(self):
return self.cell.getNexsIndx()
Expand Down Expand Up @@ -983,6 +989,9 @@ async def _killActiveCoro(self, cdef):
task.cancel()
await asyncio.sleep(0)

async def isCellActive(self):
return self.isactive

async def setCellActive(self, active):
self.isactive = active

Expand Down
1 change: 1 addition & 0 deletions synapse/tests/test_lib_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ async def test_cell_unix_sock(self):
async with core.getLocalProxy() as prox:
user = await prox.getCellUser()
self.eq('root', user.get('name'))
self.true(await prox.isCellActive())

# Explicit use of the unix:// handler
async with self.getTestCore() as core:
Expand Down

0 comments on commit f159bd4

Please sign in to comment.