Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optional UTXO caching #930

Merged
merged 22 commits into from
May 15, 2023
Merged

feat: optional UTXO caching #930

merged 22 commits into from
May 15, 2023

Conversation

camsjams
Copy link
Contributor

@camsjams camsjams commented Apr 25, 2023

closes: #865

This option is disabled by default (a point of discussion ⚠️ )

This can be enabled like so:

Non-zero number

// uses cache time in ms
const provider = new Provider('http://127.0.0.1:4000/graphql', { cacheUtxo: 2500 });

@camsjams camsjams self-assigned this Apr 25, 2023
@camsjams camsjams marked this pull request as draft April 25, 2023 22:51
@github-actions
Copy link
Contributor

github-actions bot commented Apr 25, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
95.41% (+0.04% 🔼)
4841/5074
🟢 Branches
84.29% (+0.35% 🔼)
853/1012
🟢 Functions
92.94% (+0.07% 🔼)
934/1005
🟢 Lines
95.41% (+0.04% 🔼)
4619/4841
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / memory-cache.ts
100% 100% 100% 100%

Test suite run success

874 tests passing in 136 suites.

Report generated by 🧪jest coverage report action from 64100d0

@camsjams camsjams marked this pull request as ready for review April 25, 2023 23:18
@camsjams camsjams changed the title feat: UTXO caching feat: optional UTXO caching Apr 25, 2023
Torres-ssf
Torres-ssf previously approved these changes Apr 28, 2023
Copy link
Contributor

@Torres-ssf Torres-ssf left a comment

Choose a reason for hiding this comment

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

Hey good job 👍

About to go a little bikeshedding here...

packages/providers/src/memory-cache.ts Outdated Show resolved Hide resolved
packages/providers/src/memory-cache.ts Outdated Show resolved Hide resolved
packages/providers/src/memory-cache.ts Outdated Show resolved Hide resolved
packages/providers/src/memory-cache.ts Outdated Show resolved Hide resolved
packages/providers/src/memory-cache.ts Outdated Show resolved Hide resolved
packages/providers/src/provider.test.ts Outdated Show resolved Hide resolved
@camsjams camsjams requested a review from Torres-ssf May 8, 2023 05:59
Copy link
Member

@arboleya arboleya left a comment

Choose a reason for hiding this comment

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

Looking great.

Just this comment:

IMO, the class should have a method getAllEntries() or similar, that returns everything. Consumers could then choose to filter the entries however they like.

@camsjams camsjams requested a review from arboleya May 8, 2023 18:14
@camsjams camsjams enabled auto-merge (squash) May 8, 2023 18:15
@camsjams
Copy link
Contributor Author

camsjams commented May 8, 2023

@arboleya this has been revised to be more clear about the methods and their return data

Copy link
Member

@Dhaiwat10 Dhaiwat10 left a comment

Choose a reason for hiding this comment

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

Looking great apart from some formatting changes that crept in to provider.test.ts 🫡

packages/providers/src/provider.test.ts Show resolved Hide resolved
arboleya
arboleya previously approved these changes May 10, 2023
@Dhaiwat10
Copy link
Member

Noticed something weird. The test workflow is failing but apparently there are no logs:

image

@camsjams
Copy link
Contributor Author

Noticed something weird. The test workflow is failing but apparently there are no logs:

image

I think GitHub is having issues...

@camsjams camsjams requested a review from arboleya May 11, 2023 04:51
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.

UTXO caching mechanism
5 participants