Skip to content

Commit 0e1adee

Browse files
committed
ref: use weakmap for deno too
1 parent fb9317b commit 0e1adee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/deno/src/integrations/deno-cron.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type CronParams = [string, string | Deno.CronSchedule, CronFn | CronOptions, Cro
99

1010
const INTEGRATION_NAME = 'DenoCron';
1111

12-
const SETUP_CLIENTS: Client[] = [];
12+
const SETUP_CLIENTS = new WeakMap<Client, boolean>();
1313

1414
const denoCronIntegration = (() => {
1515
return {
@@ -37,7 +37,7 @@ const denoCronIntegration = (() => {
3737
}
3838

3939
async function cronCalled(): Promise<void> {
40-
if (SETUP_CLIENTS.includes(getClient() as Client)) {
40+
if (SETUP_CLIENTS.has(getClient() as Client)) {
4141
return;
4242
}
4343

@@ -55,7 +55,7 @@ const denoCronIntegration = (() => {
5555
});
5656
},
5757
setup(client) {
58-
SETUP_CLIENTS.push(client);
58+
SETUP_CLIENTS.set(client, true);
5959
},
6060
};
6161
}) satisfies IntegrationFn;

0 commit comments

Comments
 (0)