Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoseinaghaei committed Feb 15, 2024
1 parent 46f9201 commit 9e1b03c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kafka_server/broker/file/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def read_data(self):
key, value = self.segment.read()
md5 = hash_md5(key)
partition_count = get_partition_count()
if int(md5, 16) % partition_count != int(self.partition) - 1:
if int(md5, 16) % partition_count != (int(self.partition) - 1) % partition_count:
print("data for other partition", flush=True)
self.segment.approve_reading()
return self.read_data()
Expand All @@ -88,7 +88,7 @@ def pull_data(self):
if self.message_in_fly:
print("there is message in fly")
return None, None
print("there is no message in fly", flush=True)
print("there is no message in fly in pull", flush=True)
if not self.check_data_exist():
return None, None

Expand All @@ -98,7 +98,7 @@ def pull_data(self):

md5 = hash_md5(key)
partition_count = get_partition_count()
if int(md5, 16) % partition_count != int(self.partition) - 1:
if int(md5, 16) % partition_count != (int(self.partition) - 1) % partition_count:
self.segment.approve_reading()
return self.pull_data()

Expand Down

0 comments on commit 9e1b03c

Please sign in to comment.