Skip to content

Commit

Permalink
fix increase of wait time
Browse files Browse the repository at this point in the history
  • Loading branch information
ekneg54 committed Aug 27, 2024
1 parent 16257ca commit 36e132c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions logprep/framework/pipeline_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
class ThrottlingQueue(multiprocessing.queues.Queue):
"""A queue that throttles the number of items that can be put into it."""

wait_time = 0.0000000000000001
wait_time = 0.0000000000000000001

@property
def consumed_percent(self):
def consumed_percent(self) -> int:
"""Return the percentage of items consumed."""
return self.qsize() / self.capacity
return int(self.qsize() / self.capacity * 100)

def __init__(self, ctx, maxsize):
super().__init__(ctx=ctx, maxsize=maxsize)
Expand All @@ -44,7 +44,7 @@ def throttle(self, batch_size=1):

def put(self, obj, block=True, timeout=None, batch_size=1):
"""Put an obj into the queue."""
if self.consumed_percent >= 0.9:
if self.consumed_percent >= 90:
self.throttle(batch_size)
super().put(obj, block=block, timeout=timeout)

Expand Down

0 comments on commit 36e132c

Please sign in to comment.