UNPKG

startgg-helper-node

Version:

A set of functions and classes useful to communicate with the start.gg API.

39 lines (35 loc) 1.06 kB
import { Query } from "startgg-helper"; import { StartGGDelayQueryLimiter } from "startgg-helper"; const schema = ` query Sets($slug: String, $page: Int, $perPage: Int) { event(slug: $slug){ sets(page: $page, perPage: $perPage){ nodes { id } } } } ` let query = new Query(schema, 3); export async function testLong(client){ try { let limiter = new StartGGDelayQueryLimiter(); let promises = []; for (let i = 0; i < 50; i++){ for (let j = 0; j < 2; j++){ promises.push(query.execute(client, { slug: `tournament/stock-o-clock-${i}/event/1v1-ultimate`, page: j, perPage: 10 }, limiter)); } } let result = await Promise.all(promises); limiter.stop(); return result; } catch (err){ console.error(err); return null; } }