fix: data race

This commit is contained in:
xucong053
2022-07-04 17:14:39 +08:00
committed by 徐聪
parent b654f32cc3
commit d67764e49c
4 changed files with 8 additions and 7 deletions

View File

@@ -289,6 +289,9 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
// reset start time only once
once := sync.Once{}
// update session variables mutex
mutex := sync.Mutex{}
return &boomer.Task{
Name: testcase.Config.Name,
Weight: testcase.Config.Weight,
@@ -299,9 +302,11 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
// init session runner
sessionRunner := caseRunner.newSession()
mutex.Lock()
if parametersIterator.HasNext() {
sessionRunner.updateSessionVariables(parametersIterator.Next())
}
mutex.Unlock()
startTime := time.Now()
for _, step := range testcase.TestSteps {

View File

@@ -281,7 +281,7 @@ func (r *HRPRunner) newCaseRunner(testcase *TestCase) (*testCaseRunner, error) {
timeout := time.Duration(runner.testCase.Config.Timeout*1000) * time.Millisecond
runner.hrpRunner.SetTimeout(timeout)
}
if plugin.Path() != "" {
if plugin != nil {
pluginContent, err := builtin.ReadFile(plugin.Path())
if err != nil {
return nil, err