Skip to content

fix: isolate automation pubsub Redis client and recover stats consumption - #900

Merged
freeplant merged 2 commits into
masterfrom
fix/automation-stats-redis-resilience
Aug 6, 2026
Merged

freeplant merged 2 commits into
masterfrom
fix/automation-stats-redis-resilience

Conversation

@AlexCXC

@AlexCXC AlexCXC commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@seafile-dev seafile-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: Comment

Warnings:

  • Test-automation requests that complete after ten minutes now fail although the previous fifteen-minute contract allowed them; see inline comment.
    Suggested fix: retain the 15-minute deadline unless a coordinated product/API change explicitly requires a shorter timeout.
  • The Redis reconnect race is not covered by automated regression testing.
    Suggested fix: add a focused test that reconnects the subscriber client while stats() uses the command client, and assert that stats consumption continues.

The Redis client split correctly isolates refresh_subscriber() from normal queue commands; the PR's existing build is green.


self._redis_client = RedisClient(socket_connect_timeout=5, socket_timeout=10,
health_check_interval=30, retry_on_timeout=True)
# Keep pubsub reconnects isolated from regular Redis commands.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Warning] Missing reconnect regression test

Why this matters:
This fix depends on refresh_subscriber() reconnecting only the subscriber client while stats() continues using the command client. The current CI runs SQL tests only, so a future client refactor could silently reintroduce the thread-exit race.

Suggested fix: add a focused unit test that forces a subscriber refresh during stats queue consumption and verifies the command client can still pop and process a result.

if done:
break
if time.time() - start_at > 15 * 60:
if time.time() - start_at > 10 * 60:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Warning] Shortened test-task deadline

Why this matters:
This unrelated change makes a test automation that completes between 10 and 15 minutes report a timeout, whereas the previous behavior waited 15 minutes. The result can therefore complete successfully but the caller still receives a failure.

Suggested fix: keep the existing 15-minute timeout for this bug fix, or document and coordinate the new 10-minute API behavior with its callers.

@freeplant
freeplant merged commit b499b2f into master Aug 6, 2026
1 check passed
@freeplant
freeplant deleted the fix/automation-stats-redis-resilience branch August 6, 2026 09:19
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.

3 participants