Skip to content

Commit

Permalink
Merge pull request Aiven-Open#385 from aiven/hacka-moved-lock
Browse files Browse the repository at this point in the history
schema_registry: made lock private
  • Loading branch information
tvainika authored Apr 8, 2022
2 parents 228117f + 880dddc commit dff56df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions karapace/karapace.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from karapace.rapu import HTTPResponse, RestApp
from typing import NoReturn, Union

import asyncio
import logging


Expand All @@ -23,7 +22,6 @@ def __init__(self, config: Config) -> None:
self.route("/", callback=self.root_get, method="GET")
self.log = logging.getLogger("Karapace")
self.app.on_startup.append(self.create_http_client)
self.master_lock = asyncio.Lock()
self.log.info("Karapace initialized")
self.app.on_shutdown.append(self.close_by_app)

Expand Down
3 changes: 2 additions & 1 deletion karapace/schema_registry_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self, config: Config) -> None:
self.ksr = KafkaSchemaReader(config=self.config, master_coordinator=self.mc)
self.ksr.start()
self.schema_lock = asyncio.Lock()
self._master_lock = asyncio.Lock()

def _create_producer(self) -> KafkaProducer:
while True:
Expand Down Expand Up @@ -643,7 +644,7 @@ async def subject_versions_list(self, content_type, *, subject):
self.r(list(subject_data["schemas"]), content_type, status=HTTPStatus.OK)

async def get_master(self) -> Tuple[bool, Optional[str]]:
async with self.master_lock:
async with self._master_lock:
while True:
are_we_master, master_url = self.mc.get_master_info()
if are_we_master is None:
Expand Down

0 comments on commit dff56df

Please sign in to comment.