mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
remove sleep function
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { LIST_ITEM_SIZE } from "./constants.js";
|
import { LIST_ITEM_SIZE } from "./constants.js";
|
||||||
import { requestGateway } from "./helpers.js";
|
import { requestGateway } from "./helpers.js";
|
||||||
import { sleep } from "./utils.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Zero Trust lists.
|
* Gets Zero Trust lists.
|
||||||
@@ -47,7 +46,6 @@ export const createZeroTrustListsOneByOne = async (items) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await createZeroTrustList(listName, chunk);
|
await createZeroTrustList(listName, chunk);
|
||||||
await sleep();
|
|
||||||
totalListNumber--;
|
totalListNumber--;
|
||||||
listNumber++;
|
listNumber++;
|
||||||
console.log(`Created "${listName}" list - ${totalListNumber} left`);
|
console.log(`Created "${listName}" list - ${totalListNumber} left`);
|
||||||
@@ -104,7 +102,6 @@ export const deleteZeroTrustListsOneByOne = async (lists) => {
|
|||||||
for (const { id, name } of lists) {
|
for (const { id, name } of lists) {
|
||||||
try {
|
try {
|
||||||
await deleteZeroTrustList(id);
|
await deleteZeroTrustList(id);
|
||||||
await sleep();
|
|
||||||
totalListNumber--;
|
totalListNumber--;
|
||||||
console.log(`Deleted ${name} list - ${totalListNumber} left`);
|
console.log(`Deleted ${name} list - ${totalListNumber} left`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -7,13 +7,6 @@ if (!globalThis.fetch) {
|
|||||||
globalThis.fetch = (await import("node-fetch")).default;
|
globalThis.fetch = (await import("node-fetch")).default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sleeps for a specified amount of time.
|
|
||||||
* @param {number} [ms=350] The amount of time in ms.
|
|
||||||
*/
|
|
||||||
export const sleep = (ms = 350) =>
|
|
||||||
new Promise((resolve) => setTimeout(resolve, ms));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the value is a valid domain.
|
* Checks if the value is a valid domain.
|
||||||
* @param {string} value The value to be checked.
|
* @param {string} value The value to be checked.
|
||||||
|
|||||||
Reference in New Issue
Block a user