@@ -19,7 +19,6 @@ import { validateUrlWithDNS } from '@/lib/core/security/input-validation.server'
1919import { SSE_HEADERS } from '@/lib/core/utils/sse'
2020import { getBaseUrl } from '@/lib/core/utils/urls'
2121import { markExecutionCancelled } from '@/lib/execution/cancellation'
22- import { decrementSSEConnections , incrementSSEConnections } from '@/lib/monitoring/sse-connections'
2322import { checkWorkspaceAccess } from '@/lib/workspaces/permissions/utils'
2423import { getWorkspaceBilledAccountUserId } from '@/lib/workspaces/utils'
2524import {
@@ -631,11 +630,9 @@ async function handleMessageStream(
631630 }
632631
633632 const encoder = new TextEncoder ( )
634- let messageStreamDecremented = false
635633
636634 const stream = new ReadableStream ( {
637635 async start ( controller ) {
638- incrementSSEConnections ( 'a2a-message' )
639636 const sendEvent = ( event : string , data : unknown ) => {
640637 try {
641638 const jsonRpcResponse = {
@@ -845,19 +842,10 @@ async function handleMessageStream(
845842 } )
846843 } finally {
847844 await releaseLock ( lockKey , lockValue )
848- if ( ! messageStreamDecremented ) {
849- messageStreamDecremented = true
850- decrementSSEConnections ( 'a2a-message' )
851- }
852845 controller . close ( )
853846 }
854847 } ,
855- cancel ( ) {
856- if ( ! messageStreamDecremented ) {
857- messageStreamDecremented = true
858- decrementSSEConnections ( 'a2a-message' )
859- }
860- } ,
848+ cancel ( ) { } ,
861849 } )
862850
863851 return new NextResponse ( stream , {
@@ -1042,22 +1030,16 @@ async function handleTaskResubscribe(
10421030 { once : true }
10431031 )
10441032
1045- let sseDecremented = false
10461033 const cleanup = ( ) => {
10471034 isCancelled = true
10481035 if ( pollTimeoutId ) {
10491036 clearTimeout ( pollTimeoutId )
10501037 pollTimeoutId = null
10511038 }
1052- if ( ! sseDecremented ) {
1053- sseDecremented = true
1054- decrementSSEConnections ( 'a2a-resubscribe' )
1055- }
10561039 }
10571040
10581041 const stream = new ReadableStream ( {
10591042 async start ( controller ) {
1060- incrementSSEConnections ( 'a2a-resubscribe' )
10611043 const sendEvent = ( event : string , data : unknown ) : boolean => {
10621044 if ( isCancelled || abortSignal . aborted ) return false
10631045 try {
0 commit comments