}
}
private void pullTweets(Key key, Twitter twitter) {
try {
RateLimitStatus rateLimitStatus = twitter.getRateLimitStatus();
if (rateLimitStatus.getRemainingHits() == 0)
return;
double currentRate = (rateLimitStatus.getHourlyLimit() - rateLimitStatus
.getRemainingHits())
/ (3601 - rateLimitStatus.getSecondsUntilReset());
logger.info(
"Current twitter refresh rate: {}/h, official refresh rate: {}",
String.format("%1.1f", currentRate),
rateLimitStatus.getHourlyLimit());
if (currentRate > rateLimitStatus.getHourlyLimit()) {
logger.info("Skipped refreshing Twitter feeds to limit the refresh rate");
return;
}
ResponseList<Status> newFriendsTimeline = twitter.getHomeTimeline();