Skip to content

Commit b424517

Browse files
authored
Merge pull request #81 from mkmkme/mkmkme/issue-49
github: replace call for sleep with wait-for-it.sh
2 parents b10b338 + 798569b commit b424517

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/integration.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ jobs:
7979
pip install "libvalkey>=4.0.0"
8080
fi
8181
invoke devenv
82-
sleep 10 # time to settle
82+
if [[ "${{matrix.test-type}}" == "standalone" ]]; then
83+
./util/wait-for-it.sh localhost:6379
84+
else
85+
./util/wait-for-it.sh localhost:16379
86+
fi
8387
invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }}
8488
if [[ "${{matrix.python-version}}" != pypy-* ]]; then
8589
invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }}

valkey/cluster.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,10 @@ def initialize(self):
16481648
self.nodes_cache = tmp_nodes_cache
16491649
self.slots_cache = tmp_slots
16501650
# Set the default node
1651-
self.default_node = self.get_nodes_by_server_type(PRIMARY)[0]
1651+
try:
1652+
self.default_node = self.get_nodes_by_server_type(PRIMARY)[0]
1653+
except IndexError:
1654+
raise ValkeyClusterException("No primary nodes found in the cluster")
16521655
if self._dynamic_startup_nodes:
16531656
# Populate the startup nodes with all discovered nodes
16541657
self.startup_nodes = tmp_nodes_cache

0 commit comments

Comments
 (0)