abort all chains
This commit is contained in:
parent
2798e34e4f
commit
70ad69a5b0
|
|
@ -80,3 +80,16 @@ async def abort_chain_controller(
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Error during chain abortion")
|
logger.exception("Error during chain abortion")
|
||||||
raise HTTPException(status_code=400, detail="Chain abortion error :)")
|
raise HTTPException(status_code=400, detail="Chain abortion error :)")
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/abort_all_chains")
|
||||||
|
async def abort_all_chains_controller(
|
||||||
|
running_chain_repository: RunningChainRepositoryDependency,
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
await running_chain_repository.delete_all()
|
||||||
|
return {}
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Error during all chains abortion")
|
||||||
|
raise HTTPException(status_code=400, detail="Chains abortion error :)")
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,6 @@ class RunningChainRepository:
|
||||||
async def delete(self, chain_id: str):
|
async def delete(self, chain_id: str):
|
||||||
query = {"chainId": chain_id}
|
query = {"chainId": chain_id}
|
||||||
await self.collection.delete_one(query)
|
await self.collection.delete_one(query)
|
||||||
|
|
||||||
|
async def delete_all(self):
|
||||||
|
await self.collection.delete_many({})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user