chore: add changeset for AbortSignal fix in msgraph provider

Signed-off-by: Lokesh Kaki <lokeshkaki1@gmail.com>
This commit is contained in:
Lokesh Kaki
2026-03-06 23:00:21 -06:00
parent 9d384541e2
commit 97eaecf50f
3 changed files with 18 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-msgraph': patch
---
Fixed scheduler task remaining stuck in running state after pod termination by propagating AbortSignal into MicrosoftGraphOrgEntityProvider.read()
@@ -286,19 +286,24 @@ describe('MicrosoftGraphOrgEntityProvider', () => {
readMicrosoftGraphOrgMocked.mockImplementationOnce(
async (_client, _tenantId, options) => {
if (options.signal?.aborted) {
throw new DOMException('The operation was aborted', 'AbortError');
const error = new Error('The operation was aborted');
error.name = 'AbortError';
throw error;
}
return { users: [], groups: [] };
},
);
const taskDef = localTaskRunner.getTasks()[0];
// Should resolve without throwing (the error is caught and logged internally)
// Should resolve without throwing (abort is caught and logged at debug level)
await (taskDef.fn as (signal: AbortSignal) => Promise<void>)(
controller.signal,
);
expect(entityProviderConnection.applyMutation).not.toHaveBeenCalled();
expect(logger.debug).toHaveBeenCalledWith(
expect.stringContaining('refresh aborted due to shutdown'),
);
});
it('fail without schedule and scheduler', () => {
@@ -397,6 +397,12 @@ export class MicrosoftGraphOrgEntityProvider implements EntityProvider {
try {
await this.read({ logger, signal: abortSignal });
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
logger.debug(
`${this.getProviderName()} refresh aborted due to shutdown`,
);
return;
}
logger.error(
`${this.getProviderName()} refresh failed, ${error}`,
error,