public function executeAsync(CommandInterface $c)
{
return Promise\coroutine(function () use($c) {
if ($region = $this->cache->get($this->getCacheKey($c['Bucket']))) {
$c = $this->getRegionalizedCommand($c, $region);
}
try {
(yield parent::executeAsync($c));
} catch (PermanentRedirectException $e) {
if (empty($c['Bucket'])) {
throw $e;
}
$region = (yield $this->lookupBucketRegion($c['Bucket']));
$this->cache->set($this->getCacheKey($c['Bucket']), $region);
$c = $this->getRegionalizedCommand($c, $region);
(yield parent::executeAsync($c));
}
});
}