MCPcopy Create free account
hub / github.com/ExtendDB/extenddb / refresh_shards

Function refresh_shards

samples/stream_consumer.py:123–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121 shard_iterators: dict[str, str | None] = {}
122
123 def refresh_shards():
124 resp = streams_client.describe_stream(StreamArn=stream_arn)
125 for shard in resp["StreamDescription"]["Shards"]:
126 sid = shard["ShardId"]
127 if sid not in shard_iterators:
128 it = streams_client.get_shard_iterator(
129 StreamArn=stream_arn,
130 ShardId=sid,
131 ShardIteratorType="TRIM_HORIZON",
132 )
133 shard_iterators[sid] = it["ShardIterator"]
134 log("POLLER", f"Tracking shard {sid}")
135
136 refresh_shards()
137

Callers 1

poller_threadFunction · 0.85

Calls 2

logFunction · 0.85
describe_streamMethod · 0.80

Tested by

no test coverage detected