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

Pause timer on fetch #1756

Merged
merged 9 commits into from
Nov 15, 2023
Merged

Pause timer on fetch #1756

merged 9 commits into from
Nov 15, 2023

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Sep 20, 2023

This PR adds notifications from the network access endowment that are sent during fetch. Calling fetch will result in OutboundRequest upfront and OutboundResponse once the promise resolves. Furthermore, once per response object, triggering an async action, e.g. json() will also trigger OutboundRequest upfront and OutboundResponse once the promise resolves. The notifications pause the request processing timer in the same way that requests via snap.request and ethereum.request pause the timer.

This PR also refactors the endowment creation slightly to make it take an options bag and always require an endowment array.

Closes #1755

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (27fe061) 96.15% compared to head (1a59233) 96.03%.

Files Patch % Lines
...tion-environments/src/common/endowments/network.ts 85.29% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1756      +/-   ##
==========================================
- Coverage   96.15%   96.03%   -0.12%     
==========================================
  Files         263      263              
  Lines        6086     6129      +43     
  Branches      989      991       +2     
==========================================
+ Hits         5852     5886      +34     
- Misses        234      243       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FrederikBolding FrederikBolding changed the title Experiment with pausing on fetch Pause timer on fetch Nov 1, 2023
@FrederikBolding FrederikBolding marked this pull request as ready for review November 1, 2023 15:44
@FrederikBolding FrederikBolding requested a review from a team as a code owner November 1, 2023 15:44
@FrederikBolding FrederikBolding force-pushed the fb/pause-on-fetch branch 2 times, most recently from a0bccd3 to 0e044db Compare November 9, 2023 08:58
@FrederikBolding FrederikBolding merged commit 8d3710b into main Nov 15, 2023
136 of 138 checks passed
@FrederikBolding FrederikBolding deleted the fb/pause-on-fetch branch November 15, 2023 09:50
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.

Investigate pausing timer while the snap is waiting for the network
2 participants