소스 검색

Distribution: test random object in bags

Joystream Stats 2 년 전
부모
커밋
cf3bbdaf38
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/components/Distribution/util.ts

+ 2 - 1
src/components/Distribution/util.ts

@@ -25,7 +25,8 @@ export const testBag = async (
 ): Promise<[string, number]> => {
   if (!objects) return `warning`;
   if (!objects.length) return ``;
-  const url = endpoint + `api/v1/assets/${objects[0].id}`;
+  const object = Math.round(Math.random() * (objects.length - 1));
+  const url = endpoint + `api/v1/assets/${objects[object].id}`;
   return axios
     .head(url)
     .then((data) => `success`)