DeployHubProject / DeployHub-Pro

DeployHub Pro Pipeline Status Project
https://www.openmakesoftware.com/application-release-automation-for-continuous-delivery/
Other
11 stars 4 forks source link

optimize /dmadminweb/API/basecomponent/ #345

Open piyush94 opened 3 years ago

piyush94 commented 3 years ago

Currently this API endpoint loops through predecessorid till it reaches null to find base component for a given component id. And it takes somewhere between 10-40 seconds to get a the basecomponent id for a component which has many versions.

Why not return the component with id=parentid which is the id of the basecomponent and if it's null then just return the component itself? This will make this API endpoint a lot faster.

piyush94 commented 3 years ago

Also when using deployhub python library's function add_compver_to_appver the replacement is found early on but the for loop doesn't break.

new component id: 8938 old component id: 7462

which is getting replaced with 8938 at the end, even though 7462 was found earlier.

[08/Sep/2021:08:54:26 +0000] "GET /dmadminweb/API/basecomponent/8938 HTTP/1.1" 200 2596 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:28 +0000] "GET /dmadminweb/API/application/885 HTTP/1.1" 200 7179 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:32 +0000] "GET /dmadminweb/API/basecomponent/7462 HTTP/1.1" 200 2596 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:36 +0000] "GET /dmadminweb/API/basecomponent/8894 HTTP/1.1" 200 20505 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:40 +0000] "GET /dmadminweb/API/basecomponent/8896 HTTP/1.1" 200 5877 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:42 +0000] "GET /dmadminweb/API/basecomponent/8897 HTTP/1.1" 200 4507 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:45 +0000] "GET /dmadminweb/API/basecomponent/8898 HTTP/1.1" 200 4733 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:48 +0000] "GET /dmadminweb/API/basecomponent/8899 HTTP/1.1" 200 10383 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:51 +0000] "GET /dmadminweb/API/basecomponent/8900 HTTP/1.1" 200 1700 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:54 +0000] "GET /dmadminweb/API/basecomponent/8901 HTTP/1.1" 200 4172 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:54:58 +0000] "GET /dmadminweb/API/basecomponent/8902 HTTP/1.1" 200 5552 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:00 +0000] "GET /dmadminweb/API/basecomponent/8903 HTTP/1.1" 200 3707 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:04 +0000] "GET /dmadminweb/API/basecomponent/8904 HTTP/1.1" 200 1497 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:06 +0000] "GET /dmadminweb/API/basecomponent/8905 HTTP/1.1" 200 3487 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:09 +0000] "GET /dmadminweb/API/basecomponent/8906 HTTP/1.1" 200 2244 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:11 +0000] "GET /dmadminweb/API/basecomponent/8908 HTTP/1.1" 200 2384 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:15 +0000] "GET /dmadminweb/API/basecomponent/8907 HTTP/1.1" 200 9776 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:18 +0000] "GET /dmadminweb/API/basecomponent/8909 HTTP/1.1" 200 8255 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:20 +0000] "GET /dmadminweb/API/basecomponent/8910 HTTP/1.1" 200 4301 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:23 +0000] "GET /dmadminweb/API/basecomponent/8911 HTTP/1.1" 200 4282 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:26 +0000] "GET /dmadminweb/API/basecomponent/8912 HTTP/1.1" 200 4955 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:30 +0000] "GET /dmadminweb/API/basecomponent/8913 HTTP/1.1" 200 13708 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:34 +0000] "GET /dmadminweb/API/basecomponent/8914 HTTP/1.1" 200 7561 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:36 +0000] "GET /dmadminweb/API/basecomponent/8915 HTTP/1.1" 200 4386 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:39 +0000] "GET /dmadminweb/API/basecomponent/8916 HTTP/1.1" 200 3885 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:42 +0000] "GET /dmadminweb/API/basecomponent/8917 HTTP/1.1" 200 10247 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:45 +0000] "GET /dmadminweb/API/basecomponent/8919 HTTP/1.1" 200 5146 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:48 +0000] "GET /dmadminweb/API/basecomponent/8920 HTTP/1.1" 200 5992 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:50 +0000] "GET /dmadminweb/API/basecomponent/8921 HTTP/1.1" 200 3704 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:54 +0000] "GET /dmadminweb/API/basecomponent/8923 HTTP/1.1" 200 9570 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:55:58 +0000] "GET /dmadminweb/API/basecomponent/8922 HTTP/1.1" 200 13793 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:01 +0000] "GET /dmadminweb/API/basecomponent/8924 HTTP/1.1" 200 5896 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:05 +0000] "GET /dmadminweb/API/basecomponent/8925 HTTP/1.1" 200 12247 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:08 +0000] "GET /dmadminweb/API/basecomponent/8926 HTTP/1.1" 200 5004 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:11 +0000] "GET /dmadminweb/API/basecomponent/8927 HTTP/1.1" 200 11069 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:14 +0000] "GET /dmadminweb/API/basecomponent/8932 HTTP/1.1" 200 1652 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:16 +0000] "GET /dmadminweb/API/basecomponent/8928 HTTP/1.1" 200 6019 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:19 +0000] "GET /dmadminweb/API/basecomponent/8929 HTTP/1.1" 200 4685 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:22 +0000] "GET /dmadminweb/API/basecomponent/8930 HTTP/1.1" 200 5395 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:25 +0000] "GET /dmadminweb/API/basecomponent/8931 HTTP/1.1" 200 4019 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:28 +0000] "GET /dmadminweb/API/basecomponent/8933 HTTP/1.1" 200 3552 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:31 +0000] "GET /dmadminweb/API/basecomponent/8934 HTTP/1.1" 200 7016 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:33 +0000] "GET /dmadminweb/API/basecomponent/8935 HTTP/1.1" 200 5685 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:37 +0000] "GET /dmadminweb/API/basecomponent/8936 HTTP/1.1" 200 7730 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:40 +0000] "GET /dmadminweb/API/basecomponent/8937 HTTP/1.1" 200 6826 "-" "python-requests/2.26.0" "-"
[08/Sep/2021:08:56:42 +0000] "GET /dmadminweb/API/replace/885/7462/8938 HTTP/1.1" 200 17 "-" "python-requests/2.26.0" "-"
sbtaylor15 commented 3 years ago

Let me check on the queries to see if we can jump to the base component directly like you said.