Skip to content

Commit

Permalink
fix: refactor update_clusters function to use named parameters for im…
Browse files Browse the repository at this point in the history
…proved readability

Signed-off-by: -LAN- <[email protected]>
  • Loading branch information
laipz8200 committed Dec 24, 2024
1 parent 1a9d127 commit 15bdacc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions api/schedule/update_tidb_serverless_status_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ def update_clusters(tidb_serverless_list: list[TidbAuthBinding]):
# batch 20
for i in range(0, len(tidb_serverless_list), 20):
items = tidb_serverless_list[i : i + 20]
# TODO: maybe we can set the default value for the following parameters in the config file
TidbService.batch_update_tidb_serverless_cluster_status(
items,
dify_config.TIDB_PROJECT_ID or "",
dify_config.TIDB_API_URL or "",
dify_config.TIDB_IAM_API_URL or "",
dify_config.TIDB_PUBLIC_KEY or "",
dify_config.TIDB_PRIVATE_KEY or "",
tidb_serverless_list=items,
project_id=dify_config.TIDB_PROJECT_ID or "",
api_url=dify_config.TIDB_API_URL or "",
iam_url=dify_config.TIDB_IAM_API_URL or "",
public_key=dify_config.TIDB_PUBLIC_KEY or "",
private_key=dify_config.TIDB_PRIVATE_KEY or "",
)
except Exception as e:
click.echo(click.style(f"Error: {e}", fg="red"))

0 comments on commit 15bdacc

Please sign in to comment.