Skip to content

fix(coordination): move WatchError import to top of shared_runtime_bag.py #8707

Closed

Description

@mrveiss

Problem

In autobot_shared/coordination/shared_runtime_bag.py, WatchError is imported inside the except block of the CAS retry loop:

except Exception as exc:
    from redis.exceptions import WatchError   # re-imported on every failed attempt
    if not isinstance(exc, WatchError):
        raise

This re-evaluates the import on every CAS failure. Move to top-of-file.

Fix

Add to module-level imports:

from redis.exceptions import WatchError

Remove the inline import.

Discovery

Found during CodeReviewer review of PR #8693 / GH#6630.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions