@@ -225,49 +225,8 @@ export class SqsServiceExtension implements ServiceExtension {
225225 this . patchArrayFunction ( messages , "forEach" ) ;
226226 this . patchArrayFunction ( messages , "map" ) ;
227227 this . patchArrayFilter ( messages ) ;
228- // this.patchArrayIterators(messages, 'values');
229- // this.patchArrayIterators(messages, Symbol.iterator);
230228 }
231229
232- // the following implementation relays on the fact that
233- // an array element processing is done once the iterator is accessed again.
234- // it fails in case of throw\return\break from the loop body which cause
235- // context manager data structure to be broken
236- //
237- // patchArrayIterators(messages: any[], functionName: any) {
238- // const self = this;
239-
240- // const contextManager = context["_getContextManager"]?.();
241- // const enterContext = contextManager?.["_enterContext"]?.bind(contextManager);
242- // const exitContext = contextManager?.["_exitContext"]?.bind(contextManager);
243- // if(!enterContext || !exitContext) return;
244-
245- // let activeMessage: any;
246-
247- // const origFunc = messages[functionName];
248- // messages[functionName] = function (...args: unknown[]) {
249- // const iterator: IterableIterator<unknown> = origFunc.apply(
250- // this,
251- // arguments
252- // );
253- // const iteratorNext = iterator.next;
254- // iterator.next = function (...args: unknown[]) {
255- // const iteratorNextResult = iteratorNext.apply(this, arguments);
256- // if(activeMessage) {
257- // exitContext();
258- // activeMessage?.[END_SPAN_FUNCTION]?.();
259- // }
260- // const messageSpan = iteratorNextResult.value?.[START_SPAN_FUNCTION]?.();
261- // if(messageSpan) {
262- // enterContext(setActiveSpan(context.active(), messageSpan));
263- // activeMessage = iteratorNextResult.value;
264- // }
265- // return iteratorNextResult;
266- // };
267- // return iterator;
268- // };
269- // }
270-
271230 patchArrayFilter ( messages : any [ ] ) {
272231 const self = this ;
273232 const origFunc = messages . filter ;
0 commit comments