aristanetworks / go-cvprac

BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

RemoveConfigletsFromDevice seems inefficient #67

Closed hansbogert closed 3 years ago

hansbogert commented 4 years ago

We have a test environment with CVP which already ramped up more than 3000 configlets. This causes the removal of configlets from a device to take over a minute.

RemoveConfigletsFromDevice() in https://github.com/aristanetworks/go-cvprac/blob/16ade42c398f789da1a2dfa49e4830bfa669301d/api/provisioning.go#L637 seems to call getConfiglets 4 times, for reasons I cannot deduce.

The remConfiglets parameter already includes the to-be-removed configlet keys and names, so why are they retrieved from the expensive getConfiglet api endpoint?

hansbogert commented 4 years ago

Please see https://github.com/hansbogert/go-cvprac/commit/c22e285be27308c7adbeb6712f17425a6d75eb85 for a possible solution

cheynearista commented 4 years ago

@hansbogert I don't have an objection to the solution. If you're comfortable with opening a pull-request with this fix I'll move forward with the Merge. Otherwise I can make the changes myself.

hansbogert commented 4 years ago

@cheynearista Please see https://github.com/aristanetworks/go-cvprac/pull/70

hansbogert commented 3 years ago

This was merged