Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Handle jump not being installed in code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Oct 11, 2023
1 parent 42ec556 commit b71dc0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/beeper-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
- uses: actions/setup-python@v2
- run: pip install poetry
- run: poetry install --extras all
- run: poetry run pip install jump-consistent-hash
- run: poetry run trial -j4 tests

test-sytest:
Expand Down
12 changes: 11 additions & 1 deletion synapse/replication/tcp/external_sharded_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from collections import defaultdict
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Dict, List, Optional, Union

import jump
from prometheus_client import Counter, Histogram
from txredisapi import ConnectionError, ConnectionHandler, RedisError

Expand All @@ -32,6 +31,13 @@
if TYPE_CHECKING:
from synapse.server import HomeServer

try:
import jump
except ImportError:
has_jump = False
else:
has_jump = True

set_counter = Counter(
"synapse_external_sharded_cache_set",
"Number of times we set a cache",
Expand Down Expand Up @@ -82,6 +88,10 @@ def __init__(self, hs: "HomeServer"):
self._reactor = hs.get_reactor()

if hs.config.redis.redis_enabled and hs.config.redis.cache_shard_hosts:
if not has_jump:
logger.error("Cannot start sharded cache, jump module not found!")
return

for shard in hs.config.redis.cache_shard_hosts:
logger.info(
"Connecting to redis (host=%r port=%r) for external cache",
Expand Down

0 comments on commit b71dc0f

Please sign in to comment.