mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-11 10:56:14 +03:00
add warnings about not using async within get_config_lock() get lock contexts
This commit is contained in:
parent
cb7c23d84b
commit
681af3835b
@ -596,6 +596,10 @@ class Farmer:
|
||||
async def set_payout_instructions(self, launcher_id: bytes32, payout_instructions: str):
|
||||
for p2_singleton_puzzle_hash, pool_state_dict in self.pool_state.items():
|
||||
if launcher_id == pool_state_dict["pool_config"].launcher_id:
|
||||
|
||||
# WARNING: async activity is not allowed inside get_config_lock()
|
||||
# TODO: enhance the lock or enforce the restriction
|
||||
|
||||
with get_config_lock(self._root_path, "config.yaml"):
|
||||
config = load_config(self._root_path, "config.yaml", acquire_lock=False)
|
||||
new_list = []
|
||||
|
@ -82,6 +82,10 @@ def add_auth_key(root_path: Path, config_entry: PoolWalletConfig, auth_key: G1El
|
||||
|
||||
|
||||
async def update_pool_config(root_path: Path, pool_config_list: List[PoolWalletConfig]):
|
||||
|
||||
# WARNING: async activity is not allowed inside get_config_lock()
|
||||
# TODO: enhance the lock or enforce the restriction
|
||||
|
||||
with get_config_lock(root_path, "config.yaml"):
|
||||
full_config = load_config(root_path, "config.yaml", acquire_lock=False)
|
||||
full_config["pool"]["pool_list"] = [c.to_json_dict() for c in pool_config_list]
|
||||
|
@ -48,6 +48,10 @@ def config_path_for_filename(root_path: Path, filename: Union[str, Path]) -> Pat
|
||||
|
||||
|
||||
def get_config_lock(root_path: Path, filename: Union[str, Path]) -> BaseFileLock:
|
||||
|
||||
# WARNING: async activity is not allowed when inside a get_config_lock() context
|
||||
# TODO: enhance the lock or enforce the restriction
|
||||
|
||||
lock_path: Path = config_path_for_filename(root_path, filename).with_suffix(".lock")
|
||||
if not lock_path.exists():
|
||||
lock_path.touch(exist_ok=True)
|
||||
|
Loading…
Reference in New Issue
Block a user