Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 19, 2022
1 parent 1d1ce43 commit 7e6e35c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lightning_app/components/serve/auto_scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ async def send_batch(self, batch: List[Tuple[str, _BatchRequestModel]]):
async def consumer(self):
while True:
await asyncio.sleep(0.05)
batch = self._batch[:self.max_batch_size]
batch = self._batch[: self.max_batch_size]
is_batch_ready = len(batch) == self.max_batch_size
is_batch_timeout = time.time() - self._last_batch_sent > self.timeout_batching
if batch and (is_batch_ready or is_batch_timeout):
asyncio.create_task(self.send_batch(batch))
# resetting the batch array, TODO - not locking the array
self._batch = self._batch[len(batch):]
self._batch = self._batch[len(batch) :]
self._last_batch_sent = time.time()

async def process_request(self, data: BaseModel):
Expand Down

0 comments on commit 7e6e35c

Please sign in to comment.