1- import { convertIntegrationFnToClass , withMonitor } from '@sentry/core' ;
1+ import { convertIntegrationFnToClass , getClient , withMonitor } from '@sentry/core' ;
22import type { IntegrationFn } from '@sentry/types' ;
33import { parseScheduleToString } from './deno-cron-format' ;
44
@@ -9,10 +9,10 @@ type CronParams = [string, string | Deno.CronSchedule, CronFn | CronOptions, Cro
99
1010const INTEGRATION_NAME = 'DenoCron' ;
1111
12- const denoCronIntegration : IntegrationFn = ( ) => {
12+ const denoCronIntegration = ( ( ) => {
1313 return {
1414 name : INTEGRATION_NAME ,
15- setupOnce ( ) {
15+ setup ( client ) {
1616 // eslint-disable-next-line deprecation/deprecation
1717 if ( ! Deno . cron ) {
1818 // The cron API is not available in this Deno version use --unstable flag!
@@ -35,6 +35,10 @@ const denoCronIntegration: IntegrationFn = () => {
3535 }
3636
3737 async function cronCalled ( ) : Promise < void > {
38+ if ( getClient ( ) !== client ) {
39+ return ;
40+ }
41+
3842 await withMonitor ( monitorSlug , async ( ) => fn ( ) , {
3943 schedule : { type : 'crontab' , value : parseScheduleToString ( schedule ) } ,
4044 // (minutes) so 12 hours - just a very high arbitrary number since we don't know the actual duration of the users cron job
@@ -49,7 +53,7 @@ const denoCronIntegration: IntegrationFn = () => {
4953 } ) ;
5054 } ,
5155 } ;
52- } ;
56+ } ) satisfies IntegrationFn ;
5357
5458/** Instruments Deno.cron to automatically capture cron check-ins */
5559// eslint-disable-next-line deprecation/deprecation
0 commit comments