Skip to content

Make host url configurable from UI#205

Open
ikorihn wants to merge 6 commits intomyzhan:masterfrom
ikorihn:configure-host-from-ui
Open

Make host url configurable from UI#205
ikorihn wants to merge 6 commits intomyzhan:masterfrom
ikorihn:configure-host-from-ui

Conversation

@ikorihn
Copy link
Copy Markdown

@ikorihn ikorihn commented Aug 20, 2024

Related to #177, this PR allows boomer to receive the host url configured in master UI.
When boomer receives the spawn message including host field, it publishes a new boomer:spawn3 event.

Comment thread _examples/http/client.go Outdated
}

// Update the host URL passed from UI
boomer.Events.Subscribe(boomer.EVENT_SPAWN3, func(workers int, spawnRate float64, host string) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

what about a more understandable name like boomer.EVENT_CONFIG?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That makes sense! I applied that f090ff9

Comment thread runner.go Outdated

numClients int32
spawnRate float64
targetHost string
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't want to keep this field. Publishing an event is enough.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I removed the field in a553bd9 .

Comment thread runner.go Outdated
func (r *runner) startSpawning(spawnCount int, spawnRate float64, spawnCompleteFunc func()) {
func (r *runner) startSpawning(spawnCount int, spawnRate float64, host string, spawnCompleteFunc func()) {
Events.Publish(EVENT_SPAWN, spawnCount, spawnRate)
Events.Publish(EVENT_SPAWN3, spawnCount, spawnRate, host)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What about Events.Publish(EVENT_CONFIG, "host", host)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have modified the code to publish the boomer:config event along with a map f090ff9 .
Is this what you meant?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

yes, thanks

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.

2 participants