Browse Source

update buckets every 30s

Joystream Stats 2 years ago
parent
commit
147e4d596d
1 changed files with 6 additions and 5 deletions
  1. 6 5
      src/components/Distribution/index.tsx

+ 6 - 5
src/components/Distribution/index.tsx

@@ -7,13 +7,14 @@ const Distribution = (props: {
   workers: { distributionWorkingGroup?: Worker[] };
 }) => {
   const [buckets, setBuckets] = useState([]);
-  useEffect(
-    () =>
+  useEffect(() => {
+    const update = () =>
       getDistributionBuckets(props.workers?.distributionWorkingGroup).then(
         (buckets) => buckets.length && setBuckets(buckets)
-      ),
-    [props.workers?.distributionWorkingGroup]
-  );
+      );
+    update();
+    setTimeout(update, 30000);
+  }, [props.workers?.distributionWorkingGroup]);
   return (
     <div className="m-2 p-2 bg-light">
       <h2>Distribution Providers</h2>