Skip to content

Commit

Permalink
Merge pull request #26 from aiven/mte-fix-schema-registry-heartbeat
Browse files Browse the repository at this point in the history
fix schema registry heartbeat

#26
  • Loading branch information
Ormod authored Mar 4, 2020
2 parents d0b935b + 7855b8a commit c01ce6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ $(KAFKA_PATH): $(KAFKA_TAR)
.PHONY: fetch-kafka
fetch-kafka: $(KAFKA_PATH)

.PHONY: kafka
kafka: fetch-kafka
.PHONY: start-kafka
start-kafka: fetch-kafka
$(KAFKA_PATH)/bin/zookeeper-server-start.sh $(KAFKA_PATH)/config/zookeeper.properties &
$(KAFKA_PATH)/bin/kafka-server-start.sh $(KAFKA_PATH)/config/server.properties &

.PHONY: stop-kafka
stop-kafka:
$(KAFKA_PATH)/bin/kafka-server-stop.sh || true
$(KAFKA_PATH)/bin/zookeeper-server-stop.sh || true

.PHONY: kafka
kafka: start-kafka

.PHONY: pylint
pylint: $(GENERATED)
python3 -m pylint --rcfile .pylintrc $(ALL_PYTHON_DIRS)
Expand Down
5 changes: 4 additions & 1 deletion karapace/master_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,20 @@ def close(self):
self.running = False

def run(self):
_hb_interval = 3.0
while self.running:
try:
if not self.kafka_client:
if self.init_kafka_client() is False:
continue
if not self.sc:
self.init_schema_coordinator()
_hb_interval = self.sc.config["heartbeat_interval_ms"] / 1000

self.sc.ensure_active_group()
self.sc.poll_heartbeat()
self.log.debug("We're master: %r: master_uri: %r", self.sc.master, self.sc.master_url)
time.sleep(5.0)
time.sleep(min(_hb_interval, self.sc.time_to_next_heartbeat()))
except: # pylint: disable=bare-except
self.log.exception("Exception in master_coordinator")
time.sleep(1.0)
Expand Down

0 comments on commit c01ce6b

Please sign in to comment.