Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove p-queue #6063

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
"moti": "0.28",
"multiformats": "9.6.2",
"nanoid": "3.2.0",
"p-queue": "7.2.0",
"p-wait-for": "4.1.0",
"pako": "2.0.4",
"parse-ms": "2.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/resources/transactions/firstTransactionTimestampQuery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useQuery } from '@tanstack/react-query';
import PQueue from 'p-queue/dist';

import { createQueryKey, queryClient, QueryConfig, QueryFunctionArgs, QueryFunctionResult } from '@/react-query';
import { getFirstTransactionTimestamp } from '@/utils/ethereumUtils';
Expand All @@ -23,8 +22,6 @@ export type FirstTransactionTimestampQueryKey = ReturnType<typeof firstTransacti
// ///////////////////////////////////////////////
// Query Function

const queue = new PQueue({ interval: 1000, intervalCap: 5 });

export async function firstTransactionTimestampQueryFunction({
queryKey: [{ addressOrName }],
}: QueryFunctionArgs<typeof firstTransactionTimestampQueryKey>) {
Expand All @@ -35,7 +32,10 @@ export async function firstTransactionTimestampQueryFunction({
address = (await fetchENSAddress({ name: addressOrName })) ?? '';
}

const timestamp = address ? await queue.add(async () => getFirstTransactionTimestamp(address)) : null;
let timestamp;
if (address) {
timestamp = await getFirstTransactionTimestamp(address);
}
return timestamp ?? null;
}

Expand Down
20 changes: 1 addition & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7976,7 +7976,6 @@ __metadata:
multiformats: "npm:9.6.2"
nanoid: "npm:3.2.0"
node-vibrant: "npm:3.2.1-alpha.1"
p-queue: "npm:7.2.0"
p-wait-for: "npm:4.1.0"
pako: "npm:2.0.4"
parse-ms: "npm:2.1.0"
Expand Down Expand Up @@ -13163,13 +13162,6 @@ __metadata:
languageName: node
linkType: hard

"eventemitter3@npm:^4.0.7":
version: 4.0.7
resolution: "eventemitter3@npm:4.0.7"
checksum: 10c0/5f6d97cbcbac47be798e6355e3a7639a84ee1f7d9b199a07017f1d2f1e2fe236004d14fa5dfaeba661f94ea57805385e326236a6debbc7145c8877fbc0297c6b
languageName: node
linkType: hard

"events@npm:3.3.0, events@npm:^3.0.0, events@npm:^3.2.0, events@npm:^3.3.0":
version: 3.3.0
resolution: "events@npm:3.3.0"
Expand Down Expand Up @@ -19590,17 +19582,7 @@ __metadata:
languageName: node
linkType: hard

"p-queue@npm:7.2.0":
version: 7.2.0
resolution: "p-queue@npm:7.2.0"
dependencies:
eventemitter3: "npm:^4.0.7"
p-timeout: "npm:^5.0.2"
checksum: 10c0/0dad31488d6afe5c27a84ed00a703eef1ed4387338e0debe8155d36172808c6ae0451be5d88a12aa41f1deb4d3583ecd19e5f6ded5f06c937b01ff828d18c6cb
languageName: node
linkType: hard

"p-timeout@npm:^5.0.0, p-timeout@npm:^5.0.2":
"p-timeout@npm:^5.0.0":
version: 5.1.0
resolution: "p-timeout@npm:5.1.0"
checksum: 10c0/1b026cf9d5878c64bec4341ca9cda8ec6b8b3aea8a57885ca0fe2b35753a20d767fb6f9d3aa41e1252f42bc95432c05ea33b6b18f271fb10bfb0789591850a41
Expand Down
Loading