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

Fix slow firewall list command #318

Merged
merged 2 commits into from
May 17, 2023
Merged

Fix slow firewall list command #318

merged 2 commits into from
May 17, 2023

Conversation

haardikdharma10
Copy link
Contributor

Background

#303

@@ -1,6 +1,7 @@
package firewall

import (
"github.com/civo/civogo"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import orders are wrong

ow := utility.NewOutputWriter()
for _, firewall := range firewalls {
network, _ := client.FindNetwork(firewall.NetworkID)
for _, network = range networks {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest before looping over firewalls , loop over Networks to create a "map[networkID]:networkLabel" .

When you run the firewall loop, you can directly use it that map to give out network name on L66 rn

@haardikdharma10 haardikdharma10 merged commit 88db175 into master May 17, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants