运动“ getShardIterator”被卡住

问题描述

从运动学中获取物品时我遇到了一个奇怪的问题。

因此,当我在流中有事件,并且我以正确的时间戳查询它们时,我会得到结果。

但是,如果我没有信息流 要么 如果我要查询没有事件的时间 通话getShardIterator陷入了几分钟。

这就是为什么我添加2秒的“超时”。

如果找不到任何事件,是否有更好的方法从运动学中得到空响应?

谢谢

<?PHP

$getKinessisClient = new GetKinessisClient();
$kinesisClient = $getKinessisClient->get([
    
]);

$params = [
    'credentials' => array(
        'key' => 'xxxx','secret' => 'xxxx',),'region' => 'xxxx','version' => 'latest','http' => [
        'timeout' => 2
    ]
];

$kinesisClient = (new Sdk())->createKinesis($params);

// get all shard ids
$res = $kinesisClient->describeStream([ 'StreamName' => $streamName ]);
$shardIds = $res->search('StreamDescription.Shards[].ShardId');

$foundItems = [];
foreach ($shardIds as $shardId) {
    try {
        $getShardItParams = [
            'ShardId' => $shardId,'StreamName' => $streamName,'ShardIteratorType' => 'AT_TIMESTAMP','Timestamp' => $from_timestamp,//PROBLEM HERE
        ];
        
        // this gets stuck (without timeout)
        $res = $kinesisClient->getShardIterator($getShardItParams);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)