-
Notifications
You must be signed in to change notification settings - Fork 243
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
Make host url configurable from UI #205
base: master
Are you sure you want to change the base?
Changes from 3 commits
39c48b0
bb39efd
2cc2ff0
a553bd9
f090ff9
5d63269
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ type runner struct { | |
|
||
numClients int32 | ||
spawnRate float64 | ||
targetHost string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the field in a553bd9 . |
||
|
||
// Cancellation method for all running workers(goroutines) | ||
cancelFuncs []context.CancelFunc | ||
|
@@ -246,8 +247,9 @@ func (r *runner) getTask(index int) *Task { | |
return r.runTask[index] | ||
} | ||
|
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about Events.Publish(EVENT_CONFIG, "host", host)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have modified the code to publish the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, thanks |
||
|
||
r.spawnWorkers(spawnCount, spawnCompleteFunc) | ||
} | ||
|
@@ -310,7 +312,7 @@ func (r *localRunner) run() { | |
if r.rateLimitEnabled { | ||
r.rateLimiter.Start() | ||
} | ||
r.startSpawning(r.spawnCount, r.spawnRate, nil) | ||
r.startSpawning(r.spawnCount, r.spawnRate, r.targetHost, nil) | ||
|
||
wg.Wait() | ||
} | ||
|
@@ -429,9 +431,15 @@ func (r *slaveRunner) onSpawnMessage(msg *genericMessage) { | |
} | ||
} | ||
|
||
if host, ok := msg.Data["host"]; ok { | ||
if host, ok := host.([]byte); ok { | ||
r.targetHost = string(host) | ||
} | ||
} | ||
|
||
r.client.sendChannel() <- newGenericMessage("spawning", nil, r.nodeID) | ||
workers := r.sumUsersAmount(msg) | ||
r.startSpawning(workers, float64(workers), r.spawnComplete) | ||
r.startSpawning(workers, float64(workers), r.targetHost, r.spawnComplete) | ||
} | ||
|
||
// TODO: consider to add register_message instead of publishing any unknown type as custom_message. | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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