1
- import { convertIntegrationFnToClass , withMonitor } from '@sentry/core' ;
1
+ import { convertIntegrationFnToClass , getClient , withMonitor } from '@sentry/core' ;
2
2
import type { IntegrationFn } from '@sentry/types' ;
3
3
import { parseScheduleToString } from './deno-cron-format' ;
4
4
@@ -9,10 +9,10 @@ type CronParams = [string, string | Deno.CronSchedule, CronFn | CronOptions, Cro
9
9
10
10
const INTEGRATION_NAME = 'DenoCron' ;
11
11
12
- const denoCronIntegration : IntegrationFn = ( ) => {
12
+ const denoCronIntegration = ( ( ) => {
13
13
return {
14
14
name : INTEGRATION_NAME ,
15
- setupOnce ( ) {
15
+ setup ( client ) {
16
16
// eslint-disable-next-line deprecation/deprecation
17
17
if ( ! Deno . cron ) {
18
18
// The cron API is not available in this Deno version use --unstable flag!
@@ -35,6 +35,10 @@ const denoCronIntegration: IntegrationFn = () => {
35
35
}
36
36
37
37
async function cronCalled ( ) : Promise < void > {
38
+ if ( getClient ( ) !== client ) {
39
+ return ;
40
+ }
41
+
38
42
await withMonitor ( monitorSlug , async ( ) => fn ( ) , {
39
43
schedule : { type : 'crontab' , value : parseScheduleToString ( schedule ) } ,
40
44
// (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 = () => {
49
53
} ) ;
50
54
} ,
51
55
} ;
52
- } ;
56
+ } ) satisfies IntegrationFn ;
53
57
54
58
/** Instruments Deno.cron to automatically capture cron check-ins */
55
59
// eslint-disable-next-line deprecation/deprecation
0 commit comments