@@ -782,6 +782,19 @@ export const make = Effect.gen(function* () {
782782 if ( claimedGeneration === null ) {
783783 return false ;
784784 }
785+ // After a failed delete: succeed if the tunnel is gone, since the delete
786+ // then took effect and only its response was lost; otherwise keep the
787+ // delete's error.
788+ const confirmTunnelGone = (
789+ failure : ManagedEndpointDeprovisioningFailed ,
790+ ) : Effect . Effect < void , ManagedEndpointDeprovisioningFailed > =>
791+ tunnels . get ( tunnelId ) . pipe (
792+ Effect . andThen ( Effect . fail ( failure ) ) ,
793+ Effect . catchTags ( {
794+ ManagedEndpointTunnelClientError : ( lookupFailure ) =>
795+ isManagedEndpointNotFound ( lookupFailure . cause ) ? Effect . void : Effect . fail ( failure ) ,
796+ } ) ,
797+ ) ;
785798 const deleteTunnel = ignoreNotFound ( tunnels . delete ( tunnelId ) ) . pipe (
786799 Effect . mapError (
787800 ( cause ) =>
@@ -873,16 +886,7 @@ export const make = Effect.gen(function* () {
873886 // released marker, must commit, since no later sweep can find
874887 // this tunnel again to retry.
875888 yield * deleteTunnel . pipe (
876- Effect . catchTag ( "ManagedEndpointDeprovisioningFailed" , ( failure ) =>
877- tunnels . get ( tunnelId ) . pipe (
878- Effect . flatMap ( ( ) => Effect . fail ( failure ) ) ,
879- Effect . catchTag ( "ManagedEndpointTunnelClientError" , ( lookupFailure ) =>
880- isManagedEndpointNotFound ( lookupFailure . cause )
881- ? Effect . void
882- : Effect . fail ( failure ) ,
883- ) ,
884- ) ,
885- ) ,
889+ Effect . catchTags ( { ManagedEndpointDeprovisioningFailed : confirmTunnelGone } ) ,
886890 ) ;
887891 return true ;
888892 } ) ,
0 commit comments