Skip to content

add server sync method script#1036

Merged
helloyongyang merged 1 commit intomainfrom
feat-server
Apr 23, 2026
Merged

add server sync method script#1036
helloyongyang merged 1 commit intomainfrom
feat-server

Conversation

@black-eleven
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a suite of utility scripts and documentation for interacting with the LightX2V server's image generation APIs. The additions include benchmarking tools for S3 latency, scripts for asynchronous and synchronous Text-to-Image (T2I) and Image-to-Image (I2I) tasks using base64 or presigned URLs, and a comprehensive usage guide. The review feedback identifies two technical improvements: replacing time.time() with time.monotonic() for more robust deadline calculations in polling loops, and fixing a logic error where a PUT presigned URL could incorrectly be used for download verification, leading to a 403 error.

Comment on lines +46 to +48
deadline = time.time() + timeout_seconds

while time.time() < deadline:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using time.time() for calculating deadlines and measuring durations is discouraged because it is not monotonic. System clock adjustments (e.g., via NTP) can cause the loop to terminate prematurely or hang. It is better to use time.monotonic() for this purpose.

Suggested change
deadline = time.time() + timeout_seconds
while time.time() < deadline:
deadline = time.monotonic() + timeout_seconds
while time.monotonic() < deadline:

output_path=args.download_output,
timeout_seconds=args.download_timeout_seconds,
)
print(f"Downloaded uploaded image to: {downloaded_image}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallback to result.get("presigned_url") for download verification is problematic. In presigned_url mode, the server returns the same PUT URL it was provided. Attempting a GET request on a PUT presigned URL will result in a 403 Forbidden error from S3. If the user provides a custom --presigned_url, they should also provide a corresponding --download_url for verification, or the script should skip the download check if no GET URL is available.

Suggested change
print(f"Downloaded uploaded image to: {downloaded_image}")
download_url = args.download_url or resolved_download_url

@helloyongyang helloyongyang merged commit fe8e642 into main Apr 23, 2026
2 checks passed
@helloyongyang helloyongyang deleted the feat-server branch April 23, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants