google / upvote_py2

A multi-platform binary whitelisting solution
Apache License 2.0
452 stars 35 forks source link

Blockables/Certs/Votes API batching #29

Closed thehesiod closed 5 years ago

thehesiod commented 5 years ago

For two different reasons: We added a "state" column to the events admin page to keep track of the current state of each event's blockable state. To do this we needed to do a page-size of requests to get the blockables, and then get any certs which were available. This is a lot of API calls and ends up making our instance count often peak

Similarly on the blockables page we grab any certs which are available for blockables to get a better state result.

I can see this being solved in one of two ways:

1) On the events query API call, a parameter which controls if you want it to return the associated blockables/certs...and similarly on the blockables query call to return any certs/votes associated with the results

2) Having batch get support for certs/blockables.

thoughts? It would be good to handle https://github.com/google/upvote/issues/28 as well with the design.

msuozzo commented 5 years ago

It sounds like you might be describing withContext (link) by which we support association of blockable+cert+vote entities (via this function).

thehesiod commented 5 years ago

fascinating, will explore this area and share my findings, thanks so much!!

thehesiod commented 5 years ago

sweet, that helped a lot (https://github.com/farmersbusinessnetwork/upvote/commit/892195880a2ec3aaa98c6a7f91e2500c1ec4ed52) ! thanks so much!

thehesiod commented 5 years ago

also sped up my blockables page with: https://github.com/farmersbusinessnetwork/upvote/commit/d5f07314d3237be8a20369222e18e083f8751f84, where I implement _GetBlockableContext