Stuck 'ASYNC: MS teams: approval notification' JobsIssue - Realized a lot of stuck jobs ASYNC: MS teams: approval notification job thread item started age---------- ------------------------ -------------------------------------- ------------------- -------appnode040 glide.scheduler.worker.0 ASYNC: MS teams: approval notification 2021-06-03 01:53:28 8:06:37appnode040 glide.scheduler.worker.6 ASYNC: MS teams: approval notification 2021-06-03 02:18:35 7:41:30appnode040 glide.scheduler.worker.4 ASYNC: MS teams: approval notification 2021-06-03 02:29:31 7:30:34appnode040 glide.scheduler.worker.2 ASYNC: MS teams: approval notification 2021-06-03 02:29:31 7:30:34appnode040 glide.scheduler.worker.3 ASYNC: MS teams: approval notification 2021-06-03 02:29:31 7:30:34appnode040 glide.scheduler.worker.7 ASYNC: MS teams: approval notification 2021-06-03 02:29:31 7:30:34appnode040 glide.scheduler.worker.5 ASYNC: MS teams: approval notification 2021-06-03 02:29:33 7:30:32appnode039 glide.scheduler.worker.6 ASYNC: MS teams: approval notification 2021-06-03 02:29:38 7:30:28appnode039 glide.scheduler.worker.0 ASYNC: MS teams: approval notification 2021-06-03 02:54:37 7:05:28 - It is not allowing other jobs to run and also slowed down the processing of eventsCause - This is caused by PRB1491770 - PRB1491770: means that the OOTB script include MSTeamsAdaptiveCardsApprovalHandler (LINK: https://[Instance_name].service-now.com/sys_script_include.do?sys_id=fc91c5315362101016adddeeff7b126b) has a function called _waitForRecord that gets on an endless loop that never breaks and causes the job ASYNC: MS teams: approval notification to get stuck.Resolution - There is additional code that needs to be added: !!!! IMPORTANT NOTE: PLEASE TEST THE CODE CHANGE TO A SUBPROD INSTANCE BEFORE IMPLEMENTING TO PRODUCTION !!!!!!! On the function _waitForRecord, change the below function in the code starting on line 132: FROM THIS: _waitForRecord: function(sourceGr) { var targetExist = false; var targetTable = sourceGr.source_table + ""; var targetId = sourceGr.document_id + ""; var targetGr; var delayed = 0; var delayMs = 100; var delayMax = 5000; while (!targetExist) { targetGr = new GlideRecord(targetTable); targetExist = targetGr.get(targetId); if (!targetExist && delayed < delayMax) { delayed += delayMs; new MSTeamsUtils().waitTime(delayMs); } } gs.debug("MSTeamsAdaptiveCardsApprovalHandler._waitForRecord total duration: " + delayed + "ms"); } TO THIS: _waitForRecord: function(sourceGr) { var targetExist = false; var targetTable = sourceGr.source_table + ""; var targetId = sourceGr.document_id + ""; var targetGr; var delayed = 0; var delayMs = 100; var delayMax = 5000; while (!targetExist) { targetGr = new GlideRecord(targetTable); targetExist = targetGr.get(targetId); if (!targetExist && delayed < delayMax) { delayed += delayMs; new MSTeamsUtils().waitTime(delayMs); } // PRB1491770 if (delayed >= delayMax) { gs.debug("MSTeamsAdaptiveCardsApprovalHandler._waitForRecord - Max delay time exceeded"); break; } } gs.debug("MSTeamsAdaptiveCardsApprovalHandler._waitForRecord total duration: " + delayed + "ms"); }