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

refactor: better caching, optional auth check #479

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

gregdhill
Copy link
Member

@gregdhill gregdhill commented Jun 22, 2023

Closes #478

  • Flush data to disk
  • Cache claim before transfer, revert on error
  • Check T&Cs have been signed if auth_url set

Manually tested to avoid spending too much time on this right now before launch setting up mocks, etc.. The tests are anyway very slow so I would like to spend time refactoring this code anyway. It would also be nice to do away with the encoded input parameter to simplify manual testing.

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
@@ -262,7 +289,7 @@ pub async fn start_http(
allowance_config: AllowanceConfig,
) -> jsonrpc_http_server::CloseHandle {
let mut io = IoHandler::default();
let store = Store::new(Config::new("./kv")).expect("Unable to open kv store");
let store = Store::new(Config::new("./kv").flush_every_ms(100)).expect("Unable to open kv store");
Copy link
Member Author

@gregdhill gregdhill Jun 22, 2023

Choose a reason for hiding this comment

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

I think the faucet previously did not write state to disk so the claim state did not persist restarts. Picked the value arbitrarily but we can probably increase it to something more sensible.

faucet/src/http.rs Outdated Show resolved Hide resolved
faucet/src/http.rs Outdated Show resolved Hide resolved
faucet/src/http.rs Show resolved Hide resolved
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
@sander2 sander2 merged commit 8fed888 into interlay:master Jun 26, 2023
8 checks passed
@gregdhill gregdhill deleted the refactor/harden-faucet branch June 27, 2023 15:25
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.

Hardening faucet
2 participants