Merge pull request #1646 from lbryio/repoll-discover
set 1hr interval on fetchFeaturedUris
This commit is contained in:
commit
3ebeb47fb0
1 changed files with 22 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue