Skip to content

refactor: remove duplicate utility logic (issue #317) - #327

Merged
El-swaggerito merged 1 commit into
Axionvera:mainfrom
Carlys17:refactor/dedupe-utils-317
Jul 30, 2026
Merged

refactor: remove duplicate utility logic (issue #317)#327
El-swaggerito merged 1 commit into
Axionvera:mainfrom
Carlys17:refactor/dedupe-utils-317

Conversation

@Carlys17

Copy link
Copy Markdown
Contributor

What was duplicated

delay() in src/utils/httpInterceptor.ts and sleep() in src/network/rpcEndpointManager.ts were identical implementations: new Promise(resolve => setTimeout(resolve, ms)).

What was centralized

  • Created src/utils/sleep.ts with the single sleep() helper
  • Updated src/utils/httpInterceptor.ts to import sleep instead of defining local delay()
  • Updated src/network/rpcEndpointManager.ts to import sleep instead of defining local sleep()
  • Added src/utils/index.ts export for the new utility

Tests

  • Added tests/sleep.test.ts (4 test cases covering timing, undefined return, zero delay, promise type)

Documentation

  • Added docs/utility-ownership.md explaining where shared utilities belong and how to avoid re-introducing duplicates

Closes #317

Removes duplicate delay() in httpInterceptor.ts and sleep() in
rpcEndpointManager.ts. Both were identical: `new Promise(resolve =>
setTimeout(resolve, ms))`. Now centralized in src/utils/sleep.ts and
imported by both callers.

Adds regression test in tests/sleep.test.ts and docs/utility-ownership.md
explaining placement rules.

Closes #317
@El-swaggerito

Copy link
Copy Markdown
Contributor
\nGitHub has not finished calculating whether this PR can be merged cleanly.\n\nThe auto-merge automation will skip this PR for now. Re-run the automation later.

@El-swaggerito
El-swaggerito merged commit 8caabba into Axionvera:main Jul 30, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove duplicate Axionvera SDK utility logic

2 participants