Skip to content

Commit 1c1a2a9

Browse files
authored
Merge pull request #532 from digital-asset/python-acs-tx-advance
python: Fix a bug where the transaction stream didn't properly reset after reading the ACS.
2 parents 192d4a6 + fc8fc2f commit 1c1a2a9

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.4.1
1+
8.4.2

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[tool.poetry]
55
name = "dazl"
6-
version = "8.4.1"
6+
version = "8.4.2"
77
description = "high-level Ledger API client for Daml ledgers"
88
license = "Apache-2.0"
99
authors = ["Davin K. Tanabe <[email protected]>"]

python/dazl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@
5757
pass
5858

5959

60-
__version__ = "8.4.1"
60+
__version__ = "8.4.2"

python/dazl/ledger/aio/__init__.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,15 @@ class Connection(PackageService, Protocol):
306306
token: Optional[TokenOrTokenProvider] = ...,
307307
timeout: Optional[TimeDeltaLike] = ...,
308308
) -> MeteringReport: ...
309+
async def prune(
310+
self,
311+
up_to: str,
312+
submission_id: Optional[str] = ...,
313+
prune_all_divulged_contracts=...,
314+
*,
315+
token: Optional[TokenOrTokenProvider] = ...,
316+
timeout: Optional[TimeDeltaLike] = ...,
317+
) -> None: ...
309318
@property
310319
def is_closed(self) -> bool: ...
311320

python/dazl/ledger/grpc/conn_aio.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,29 @@ async def get_metering_report(
11191119

11201120
# endregion
11211121

1122+
# region Miscellaneous admin calls
1123+
1124+
async def prune(
1125+
self,
1126+
up_to: str,
1127+
submission_id: Optional[str] = None,
1128+
prune_all_divulged_contracts=False,
1129+
*,
1130+
token: Optional[TokenOrTokenProvider] = None,
1131+
timeout: Optional[TimeDeltaLike] = None,
1132+
) -> None:
1133+
with self._call(token=token, timeout=timeout) as call:
1134+
stub = call.grpc_stub(lapiadminpb.ParticipantPruningServiceStub)
1135+
1136+
request = lapiadminpb.PruneRequest(
1137+
prune_up_to=up_to,
1138+
submission_id=submission_id,
1139+
prune_all_divulged_contracts=prune_all_divulged_contracts,
1140+
)
1141+
await retry(lambda: stub.Prune(request, **call.grpc_kwargs), timeout=call.timeout)
1142+
1143+
# endregion
1144+
11221145

11231146
class QueryStream(aio.QueryStreamBase):
11241147
def __init__(
@@ -1193,6 +1216,7 @@ async def items(self):
11931216
await self._emit_create(event)
11941217
case Boundary():
11951218
await self._emit_boundary(event)
1219+
offset = event.offset
11961220
case _:
11971221
warnings.warn(f"Received an unknown event: {event}", ProtocolWarning)
11981222
yield event
@@ -1208,7 +1232,7 @@ async def items(self):
12081232
# now start returning events as they come off the transaction stream; note this
12091233
# stream will never naturally close, so it's on the caller to call close() or to
12101234
# otherwise exit our current context
1211-
log.debug("Reading a transaction stream: %s", self._offset_range)
1235+
log.debug("Reading a transaction stream: %s to %s", offset, self._offset_range.end)
12121236
async for event in self._tx_events(tx_filter_pb, offset, self._offset_range.end):
12131237
log.debug("Received an event: %s", event)
12141238
match event:

0 commit comments

Comments
 (0)