@@ -139,7 +139,7 @@ export class MarQS {
139
139
public async dequeueMessageInEnv ( env : AuthenticatedEnvironment ) {
140
140
return this . #trace(
141
141
"dequeueMessageInEnv" ,
142
- async ( span , abort ) => {
142
+ async ( span ) => {
143
143
const parentQueue = this . keys . envSharedQueueKey ( env ) ;
144
144
145
145
// Read the parent queue for matching queues
@@ -150,7 +150,6 @@ export class MarQS {
150
150
) ;
151
151
152
152
if ( ! messageQueue ) {
153
- abort ( ) ;
154
153
return ;
155
154
}
156
155
@@ -167,7 +166,6 @@ export class MarQS {
167
166
} ) ;
168
167
169
168
if ( ! messageData ) {
170
- abort ( ) ;
171
169
return ;
172
170
}
173
171
@@ -181,8 +179,6 @@ export class MarQS {
181
179
[ SemanticAttributes . CONCURRENCY_KEY ] : message . concurrencyKey ,
182
180
[ SemanticAttributes . PARENT_QUEUE ] : message . parentQueue ,
183
181
} ) ;
184
- } else {
185
- abort ( ) ;
186
182
}
187
183
188
184
return message ;
@@ -204,7 +200,7 @@ export class MarQS {
204
200
public async dequeueMessageInSharedQueue ( ) {
205
201
return this . #trace(
206
202
"dequeueMessageInSharedQueue" ,
207
- async ( span , abort ) => {
203
+ async ( span ) => {
208
204
const parentQueue = constants . SHARED_QUEUE ;
209
205
210
206
// Read the parent queue for matching queues
@@ -215,7 +211,6 @@ export class MarQS {
215
211
) ;
216
212
217
213
if ( ! messageQueue ) {
218
- abort ( ) ;
219
214
return ;
220
215
}
221
216
@@ -233,7 +228,6 @@ export class MarQS {
233
228
} ) ;
234
229
235
230
if ( ! messageData ) {
236
- abort ( ) ;
237
231
return ;
238
232
}
239
233
@@ -247,8 +241,6 @@ export class MarQS {
247
241
[ SemanticAttributes . CONCURRENCY_KEY ] : message . concurrencyKey ,
248
242
[ SemanticAttributes . PARENT_QUEUE ] : message . parentQueue ,
249
243
} ) ;
250
- } else {
251
- abort ( ) ;
252
244
}
253
245
254
246
return message ;
@@ -355,17 +347,12 @@ export class MarQS {
355
347
356
348
async #trace< T > (
357
349
name : string ,
358
- fn : ( span : Span , abort : ( ) => void ) => Promise < T > ,
359
- options ?: SpanOptions
350
+ fn : ( span : Span ) => Promise < T > ,
351
+ options ?: SpanOptions & { sampleRate ?: number }
360
352
) : Promise < T > {
361
353
return tracer . startActiveSpan ( name , options ?? { } , async ( span ) => {
362
- let _abort = false ;
363
- let aborter = ( ) => {
364
- _abort = true ;
365
- } ;
366
-
367
354
try {
368
- return await fn ( span , aborter ) ;
355
+ return await fn ( span ) ;
369
356
} catch ( e ) {
370
357
if ( e instanceof Error ) {
371
358
span . recordException ( e ) ;
@@ -375,9 +362,7 @@ export class MarQS {
375
362
376
363
throw e ;
377
364
} finally {
378
- if ( ! _abort ) {
379
- span . end ( ) ;
380
- }
365
+ span . end ( ) ;
381
366
}
382
367
} ) ;
383
368
}
@@ -480,7 +465,7 @@ export class MarQS {
480
465
) {
481
466
return this . #trace(
482
467
"getRandomQueueFromParentQueue" ,
483
- async ( span , abort ) => {
468
+ async ( span ) => {
484
469
const { range, selectionId } = await queuePriorityStrategy . nextCandidateSelection (
485
470
parentQueue
486
471
) ;
@@ -497,7 +482,6 @@ export class MarQS {
497
482
) ;
498
483
499
484
if ( typeof choice !== "string" ) {
500
- abort ( ) ;
501
485
return ;
502
486
}
503
487
0 commit comments