Skip to content

Commit d0e62da

Browse files
committed
Version 1.16.0.0
1 parent 4ceac88 commit d0e62da

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-merge-conflict
66
- repo: https://github.com/asottile/yesqa
77
rev: v1.5.0
88
hooks:
99
- id: yesqa
1010
- repo: https://github.com/psf/black
11-
rev: 24.3.0
11+
rev: 24.8.0
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/pycqa/isort
1515
rev: 5.13.2
1616
hooks:
1717
- id: isort
1818
- repo: https://github.com/pycqa/flake8
19-
rev: 7.0.0
19+
rev: 7.1.1
2020
hooks:
2121
- id: flake8
2222
- repo: https://github.com/asottile/pyupgrade
23-
rev: v3.15.1
23+
rev: v3.17.0
2424
hooks:
2525
- id: pyupgrade
2626
args: ["--py39-plus"]
2727
- repo: https://github.com/pre-commit/pre-commit-hooks
28-
rev: v4.5.0
28+
rev: v4.6.0
2929
hooks:
3030
- id: end-of-file-fixer
3131
- id: trailing-whitespace

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Latest changes
44

5+
## 1.16.0.0
6+
7+
**Breaking changes**: all events received via websocket are now processed asynchronously. Ensure your handlers are accounted for concurrent access. In case not, ensure locking techniques are used (asyncio.Lock, postgres FOR UPDATE, advisory locks, etc)
8+
59
## 1.15.0.0
610

711
We now support Python >= 3.9 only

bitcart/event_delivery.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ async def _start_websocket_processing(
3939
if msg.type == WSMsgType.TEXT:
4040
try:
4141
data = msg.json()
42-
await self.process_updates(data.get("updates", []), data.get("currency", "BTC"), data.get("wallet"))
42+
asyncio.ensure_future(
43+
self.process_updates(data.get("updates", []), data.get("currency", "BTC"), data.get("wallet"))
44+
)
4345
except JSONDecodeError:
4446
pass
4547
elif msg.type == WSMsgType.CLOSED or msg.type == WSMsgType.ERROR: # pragma: no cover

bitcart/providers/jsonrpcrequests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create_request(method: str, *args: Any, **kwargs: Any) -> dict:
2020
params = list(args)
2121
elif kwargs:
2222
params = kwargs
23-
return request(method, params)
23+
return request(method, params) # type: ignore
2424

2525

2626
class RPCProxy:

pyproject.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ strict_optional = true
1717
ignore_missing_imports = true
1818

1919
[tool.pytest.ini_options]
20-
addopts = [
21-
"--cov=bitcart",
22-
"--cov-report",
23-
"term-missing",
24-
]
20+
addopts = ["--cov=bitcart", "--cov-report", "term-missing"]
2521
filterwarnings = [
2622
"error::DeprecationWarning",
2723
"error::PendingDeprecationWarning",
2824
]
29-
asyncio_mode="auto"
25+
asyncio_mode = "auto"
26+
asyncio_default_fixture_loop_scope = "function"
3027

3128
[tool.coverage.run]
3229
omit = [
@@ -42,5 +39,5 @@ omit = [
4239
exclude_lines = [
4340
"pragma: no cover",
4441
"raise NotImplementedError()",
45-
"if TYPE_CHECKING:"
42+
"if TYPE_CHECKING:",
4643
]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name="bitcart",
55
packages=find_packages(exclude=["tests", "tests.*"]),
6-
version="1.15.0.0",
6+
version="1.16.0.0",
77
license="MIT",
88
description="Bitcart coins support library",
99
long_description=open("README.md").read(),

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import socket
23

34
import pytest
@@ -108,6 +109,7 @@ async def handle_websocket(self, request):
108109
ws = web.WebSocketResponse()
109110
await ws.prepare(request)
110111
await self.reply_to_websocket(ws)
112+
await asyncio.sleep(0.5) # because events are processed asynchronously
111113
await ws.close()
112114

113115
async def reply_to_websocket(self, ws):

0 commit comments

Comments
 (0)