Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function applyUpdateState(
function buildRunningOperation(
client: Client,
expectedStatuses: string[],
options: CreateMemoryStoreUpdatePollerOptions,
getInitialResponse?: () => PromiseLike<PathUncheckedResponse>,
options?: CreateMemoryStoreUpdatePollerOptions,
): RunningOperation<PathUncheckedResponse> {
Expand All @@ -152,12 +153,12 @@ function buildRunningOperation(
pollAbortController.abort();
}
const abortSignal = pollAbortController.signal;
if (options?.abortSignal?.aborted) {
if (options.abortSignal?.aborted) {
pollAbortController.abort();
} else if (pollOptions?.abortSignal?.aborted) {
pollAbortController.abort();
} else if (!abortSignal.aborted) {
options?.abortSignal?.addEventListener("abort", abortListener, {
options.abortSignal?.addEventListener("abort", abortListener, {
once: true,
});
pollOptions?.abortSignal?.addEventListener("abort", abortListener, {
Expand All @@ -169,7 +170,7 @@ function buildRunningOperation(
try {
response = (await client.pathUnchecked(path).get({ abortSignal })) as PathUncheckedResponse;
} finally {
options?.abortSignal?.removeEventListener("abort", abortListener);
options.abortSignal?.removeEventListener("abort", abortListener);
pollOptions?.abortSignal?.removeEventListener("abort", abortListener);
}

Expand All @@ -193,6 +194,7 @@ export function createMemoryStoreUpdatePoller(
buildRunningOperation(
client,
expectedStatuses,
options,
getInitialResponse
? async () => {
initialResponse = await getInitialResponse();
Expand Down