Skip to content

Commit

Permalink
move retrying out of core into sync
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeistrich committed Aug 25, 2024
1 parent b88957d commit 775e86c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
2 changes: 0 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import {
symbolLinked,
} from './src/globals';
import { deepMerge, getValueAtPath, initializePathType, setAtPath } from './src/helpers';
import { runWithRetry } from './src/retry';
import { tracking } from './src/tracking';

export const internal = {
Expand All @@ -90,7 +89,6 @@ export const internal = {
observableFns,
optimized,
peek,
runWithRetry,
safeParse,
safeStringify,
set,
Expand Down
6 changes: 3 additions & 3 deletions src/retry.ts → src/sync/retry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isPromise } from './is';
import type { NodeInfo, RetryOptions } from './observableInterfaces';
import type { OnErrorRetryParams, SyncedGetSetBaseParams } from './sync/syncTypes';
import { isPromise } from '../is';
import type { NodeInfo, RetryOptions } from '../observableInterfaces';
import type { OnErrorRetryParams, SyncedGetSetBaseParams } from './syncTypes';

function calculateRetryDelay(retryOptions: RetryOptions, retryNum: number): number | null {
const { backoff, delay = 1000, infinite, times = 3, maxDelay = 30000 } = retryOptions;
Expand Down
14 changes: 3 additions & 11 deletions src/sync/syncObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,10 @@ import type {
SyncedOptions,
SyncedSetParams,
} from './syncTypes';
import { runWithRetry } from './retry';

const {
clone,
deepMerge,
getNode,
getNodeValue,
getValueAtPath,
globalState,
runWithRetry,
symbolLinked,
createPreviousHandler,
} = internal;
const { clone, deepMerge, getNode, getNodeValue, getValueAtPath, globalState, symbolLinked, createPreviousHandler } =
internal;

export const mapSyncPlugins: WeakMap<
ClassConstructor<ObservablePersistPlugin>,
Expand Down

0 comments on commit 775e86c

Please sign in to comment.