Skip to content

Commit

Permalink
[oss] Don't retry mutations (#26085)
Browse files Browse the repository at this point in the history
## Summary & Motivation

as titled.


## How I Tested These Changes

hardcoded mutations to return an error and saw us hit this codepath
<img width="741" alt="Screenshot 2024-11-21 at 3 40 28 PM"
src="https://github.com/user-attachments/assets/4addb93f-b5ad-461d-99c1-5068effd5844">

> Insert changelog entry or delete this section.

[ui] In OSS, mutations are no longer retried.
  • Loading branch information
salazarm authored Nov 21, 2024
1 parent cf1df01 commit 8bd7b32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions js_modules/dagster-ui/packages/app-oss/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const config = {
origin: process.env.NEXT_PUBLIC_BACKEND_ORIGIN || document.location.origin,
telemetryEnabled,
statusPolling: new Set<DeploymentStatusType>(['code-locations', 'daemons']),
idempotentMutations: false,
};

const appCache = createAppCache();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {RetryLink} from '@apollo/client/link/retry';
import {WebSocketLink} from '@apollo/client/link/ws';
import {getMainDefinition} from '@apollo/client/utilities';
import {getMainDefinition, isMutationOperation} from '@apollo/client/utilities';
import {CustomTooltipProvider} from '@dagster-io/ui-components';
import * as React from 'react';
import {useContext} from 'react';
Expand Down Expand Up @@ -67,6 +67,7 @@ export interface AppProviderProps {
origin: string;
telemetryEnabled?: boolean;
statusPolling: Set<DeploymentStatusType>;
idempotentMutations?: boolean;
};

// Used for localStorage/IndexedDB caching to be isolated between instances/deployments
Expand All @@ -82,6 +83,7 @@ export const AppProvider = (props: AppProviderProps) => {
origin,
telemetryEnabled = false,
statusPolling,
idempotentMutations = true,
} = config;

// todo dish: Change `deleteExisting` to true soon. (Current: 1.4.5)
Expand Down Expand Up @@ -112,7 +114,10 @@ export const AppProvider = (props: AppProviderProps) => {
return new RetryLink({
attempts: {
max: 3,
retryIf: async (error, _operation) => {
retryIf: async (error, operation) => {
if (!idempotentMutations && isMutationOperation(operation.query)) {
return false;
}
if (error && error.statusCode && httpStatusCodesToRetry.has(error.statusCode)) {
return true;
}
Expand Down

1 comment on commit 8bd7b32

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-53ate6rzl-elementl.vercel.app

Built with commit 8bd7b32.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.