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 Mar 21, 2024
1 parent 4919eee commit 7c789d3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pycrdt_websocket/ystore.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
from pathlib import Path
from typing import AsyncIterator, Awaitable, Callable, cast

from sqlite_anyio import connect
import anyio
from anyio import TASK_STATUS_IGNORED, Event, Lock, create_task_group
from anyio.abc import TaskGroup, TaskStatus
from pycrdt import Doc
from sqlite_anyio import connect

from .yutils import Decoder, get_new_path, write_var_uint

Expand Down Expand Up @@ -419,8 +419,7 @@ async def write(self, data: bytes) -> None:
# first, determine time elapsed since last update
cursor = await self._db.cursor()
await cursor.execute(
"SELECT timestamp FROM yupdates WHERE path = ? "
"ORDER BY timestamp DESC LIMIT 1",
"SELECT timestamp FROM yupdates WHERE path = ? " "ORDER BY timestamp DESC LIMIT 1",
(self.path,),
)
row = await cursor.fetchone()
Expand All @@ -429,9 +428,7 @@ async def write(self, data: bytes) -> None:
if self.document_ttl is not None and diff > self.document_ttl:
# squash updates
ydoc = Doc()
await cursor.execute(
"SELECT yupdate FROM yupdates WHERE path = ?", (self.path,)
)
await cursor.execute("SELECT yupdate FROM yupdates WHERE path = ?", (self.path,))
for (update,) in await cursor.fetchall():
ydoc.apply_update(update)
# delete history
Expand Down

0 comments on commit 7c789d3

Please sign in to comment.