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] Get rid of control variables #341

Merged
merged 13 commits into from
Apr 22, 2024

Conversation

panleone
Copy link
Member

@panleone panleone commented Apr 12, 2024

Abstract

Idea: Get rid of the control variables that we have in the code, like #syncing, #isFetchingLatestBlocks, isCreatingTx (maybe there are more?).

This is done by creating a wrapper class LockableFunction that "simulates c++ RAII"

Copy link

netlify bot commented Apr 12, 2024

Deploy Preview for cheery-moxie-4f1121 ready!

Name Link
🔨 Latest commit b8a414c
🔍 Latest deploy log https://app.netlify.com/sites/cheery-moxie-4f1121/deploys/662673f20be5670008df43a9
😎 Deploy Preview https://deploy-preview-341--cheery-moxie-4f1121.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@panleone panleone changed the title Pseudo raii [Refactor] Get rid of control variables Apr 12, 2024
@panleone panleone requested review from Duddino and JSKitty April 12, 2024 12:00
@panleone panleone self-assigned this Apr 12, 2024
@panleone panleone marked this pull request as draft April 12, 2024 12:03
@panleone panleone marked this pull request as ready for review April 12, 2024 13:54
JSKitty
JSKitty previously approved these changes Apr 13, 2024
Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

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

tACK 98814ec

I didn't expect to like this too much, but it makes a lot of sense and is generally cleaner to maintain or debug.

One maintenance downside to potentially think about (JS issue again lol): on functions that return anything, this might remove the type-safety of JSDoc, as I don't think the type information will be preserved through lockableFunction, thoughts?

Fortunately all current instances of lockableFunction do not return anything, so this is only a future concern if we end up using it for anything with a return type.

Copy link
Member

@Duddino Duddino left a comment

Choose a reason for hiding this comment

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

Add the parenthesis or the expect isn't run

Copy link
Member

@Duddino Duddino left a comment

Choose a reason for hiding this comment

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

tACK

@panleone panleone merged commit 640bdf9 into PIVX-Labs:master Apr 22, 2024
7 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.

3 participants