mirror of
https://github.com/langgenius/dify.git
synced 2026-02-09 04:22:06 +08:00
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
import time
|
|
|
|
import pymysql
|
|
|
|
|
|
def check_oceanbase_ready() -> bool:
|
|
try:
|
|
connection = pymysql.connect(
|
|
host="localhost",
|
|
port=2881,
|
|
user="root",
|
|
password="difyai123456",
|
|
)
|
|
affected_rows = connection.query("SELECT 1")
|
|
return affected_rows == 1
|
|
except Exception as e:
|
|
print(f"Oceanbase is not ready. Exception: {e}")
|
|
return False
|
|
finally:
|
|
if connection:
|
|
connection.close()
|
|
|
|
|
|
def main():
|
|
max_attempts = 50
|
|
retry_interval_seconds = 2
|
|
is_oceanbase_ready = False
|
|
for attempt in range(max_attempts):
|
|
try:
|
|
is_oceanbase_ready = check_oceanbase_ready()
|
|
except Exception as e:
|
|
print(f"Oceanbase is not ready. Exception: {e}")
|
|
is_oceanbase_ready = False
|
|
|
|
if is_oceanbase_ready:
|
|
break
|
|
else:
|
|
print(f"Attempt {attempt + 1} failed, retry in {retry_interval_seconds} seconds...")
|
|
time.sleep(retry_interval_seconds)
|
|
|
|
if is_oceanbase_ready:
|
|
print("Oceanbase is ready.")
|
|
else:
|
|
print(f"Oceanbase is not ready after {max_attempts} attempting checks.")
|
|
exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|