mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
refactor: docs ordering
This commit is contained in:
@@ -3,6 +3,7 @@ import { setFailed } from '@actions/core';
|
||||
import { generateAllIndices } from '@discordjs/scripts';
|
||||
import { createPool } from '@vercel/postgres';
|
||||
import { MeiliSearch } from 'meilisearch';
|
||||
import pLimit from 'p-limit';
|
||||
import { fetch } from 'undici';
|
||||
|
||||
if (!process.env.DATABASE_URL) {
|
||||
@@ -26,6 +27,9 @@ const client = new MeiliSearch({
|
||||
apiKey: process.env.SEARCH_API_KEY!,
|
||||
});
|
||||
|
||||
const limit = pLimit(10);
|
||||
let promises: Promise<any>[] = [];
|
||||
|
||||
try {
|
||||
console.log('Generating all indices...');
|
||||
const indices = await generateAllIndices({
|
||||
@@ -49,8 +53,9 @@ try {
|
||||
console.log('Uploading indices...');
|
||||
|
||||
try {
|
||||
await Promise.all(
|
||||
indices.map(async (index) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
promises = indices.map(async (index) =>
|
||||
limit(async () => {
|
||||
console.log(`Uploading ${index.index}...`);
|
||||
let task;
|
||||
try {
|
||||
@@ -71,3 +76,9 @@ try {
|
||||
const err = error as Error;
|
||||
setFailed(err.message);
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all(promises);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user