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

[XMR BOUNTY 0.42] Reduce API requests used in meile_intelligence.py #3

Open
MathNodes opened this issue Feb 11, 2024 · 2 comments
Open

Comments

@MathNodes
Copy link
Owner

Because there are so many nodes and API requests are charged by credits, constantly checking some 12,000+ nodes runs the credits thin each month. I'd like to reduce the number of API requests made to our IP intelligence service by doing the following:

  • Check node_score table for null asn value for current node in request
  • If asn == NULL then go ahead with the query else return

This will create queries only when we do not have current ASN data for the node and greatly reduce the amount of credits used.

mysql> show fields from node_score
    -> ;
+--------------+--------------+------+-----+---------+-------+
| Field        | Type         | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| node_address | varchar(100) | NO   | PRI | NULL    |       |
| asn          | varchar(15)  | YES  |     | NULL    |       |
| isp          | varchar(200) | YES  |     | NULL    |       |
| isp_type     | varchar(50)  | YES  |     | NULL    |       |
| datacenter   | tinyint(1)   | YES  |     | NULL    |       |
+--------------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

You should create a function in the class to query the table for the asn value WHERE node_address = node

The call to this function should take place before this line:

resp = requests.get(IPREGISTRY_URL % (ip,API_KEY))

and should handle the results appropriately.

This will save me a little bit of time to work on other stuff. Hence the bounty.

@NAST0R
Copy link

NAST0R commented Feb 11, 2024

Tackling it!

@trinitystake
Copy link
Contributor

I risk with this:

#4

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

No branches or pull requests

3 participants