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

Monitor funds and re-enable disabled orgs #481

Merged
merged 13 commits into from
Apr 21, 2023
Merged

Conversation

maplant
Copy link
Contributor

@maplant maplant commented Apr 20, 2023

No description provided.

jeffgrunewald
jeffgrunewald previously approved these changes Apr 20, 2023
Copy link
Contributor

@jeffgrunewald jeffgrunewald left a comment

Choose a reason for hiding this comment

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

having the default "re-enable" monitor period be in minutes without a comment or using "min" in the name is waiting to trip someone up (especially when i think we typically use seconds as our duration number).
i would minimum make a comment or name that setting to indicate minutes is the expect time scale but preferably i would document that setting is expected in seconds and make the default settings function 60 * 30

iot_packet_verifier/src/settings.rs Show resolved Hide resolved
iot_packet_verifier/src/verifier.rs Show resolved Hide resolved
@jeffgrunewald jeffgrunewald dismissed their stale review April 20, 2023 18:33

hang on a sec

Comment on lines 235 to 252
let mut org_cache = HashMap::new();
loop {
tracing::info!("Checking if any orgs need to be re-enabled");

// Fetch all disables orgs:
let mut disabled_clients = HashSet::new();
let orgs = client
.lock()
.await
.client
.list(OrgListReqV1 {})
.await
.map_err(OrgClientError::RpcError)?
.into_inner();
for org in orgs.orgs {
if org.locked {
disabled_clients.insert(org.oui);
let payer = client.fetch_org(org.oui, &mut org_cache).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't see you using disabled_clients anywhere, you're just inserting into it and then dropping it at the end of each loop?
also, i don't think you need the outer org_cache any longer since you're calling org list on each run and that's sending you back the org record, including the payer field you're using to query solana. unlike the other, you are using this cache from one run to the next, but since you're always calling the org list command and getting back the same info you need the cache isn't doing anything for you

@maplant maplant merged commit 9913e1f into main Apr 21, 2023
@maplant maplant deleted the map/fix-permanent-org-disable branch April 21, 2023 15:40
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