Merge pull request #1646 from lbryio/repoll-discover

set 1hr interval on fetchFeaturedUris
This commit is contained in:
Sean Yesmunt 2018-06-20 15:26:36 -04:00 committed by GitHub
commit 3ebeb47fb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,10 +10,30 @@ type Props = {
};
class DiscoverPage extends React.PureComponent<Props> {
componentWillMount() {
this.props.fetchFeaturedUris();
constructor() {
super();
this.continousFetch = undefined;
}
componentWillMount() {
const { fetchFeaturedUris } = this.props;
fetchFeaturedUris();
this.continousFetch = setInterval(fetchFeaturedUris, 1000 * 60 * 60);
}
componentWillUnmount() {
this.clearContinuousFetch();
}
clearContinuousFetch() {
if (this.continousFetch) {
clearInterval(this.continousFetch);
this.continousFetch = null;
}
}
continousFetch: ?number;
render() {
const { featuredUris, fetchingFeaturedUris } = this.props;
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length;