Skip to content

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

Open
@MathNodes

Description

@MathNodes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions