AWS 存储网关:刷新缓存已将太多请求发送到服务器

AWS Storage gateway : refresh cache Too many requests have been sent to server

我猜我调用 AWS Storage Gateway refreshCache 方法的频率太高了(如消息所示),但我不确定我需要等多久才能再次点击它,我们将不胜感激。

AWSStorageGateway gatewayClient = AWSStorageGatewayClientBuilder.standard().build();
 RefreshCacheRequest cacheRequest = new RefreshCacheRequest();
 cacheRequest.setFileShareARN(this.fileShareArn);
 gatewayClient.refreshCache(cacheRequest);

com.amazonaws.services.storagegateway.model.InvalidGatewayRequestException: 发送到服务器的请求过多。 (服务:AWSStorageGateway;状态代码:400;错误代码:InvalidGatewayRequestException;请求 ID:f1ffa249-6908-4ae1-9f71-93fe7f26b2af) 在 com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1712) 在 com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1367) 在 com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1113) 在 com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:770)

我觉得你可以参考一下官方文档。 https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_RefreshCache.html

如其所说,

When this API is called, it only initiates the refresh operation. When the API call completes and returns a success code, it doesn't necessarily mean that the file refresh has completed. You should use the refresh-complete notification to determine that the operation has completed before you check for new files on the gateway file share.

所以我猜想在您调用 AWS Storage Gateway refreshCache 方法后,您必须等到刷新操作完成。并且如果在此期间再次调用该方法,将会抛出一些异常。

解决方法可以参考Monitoring Your File Share设置通知