Skip to content

Commit

Permalink
Merge pull request #409 from isucon/feature/fix-scenario-panic
Browse files Browse the repository at this point in the history
guard basic viewer rand source
  • Loading branch information
kazeburo authored Nov 25, 2023
2 parents 5aed969 + 939c809 commit 7bb0ffa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bench/cmd/bench/supervise.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func execBench(ctx context.Context, job *Job) (*Result, error) {
benchOptions = append(benchOptions, "--enable-ssl")
benchOptions = append(benchOptions, "--target", "https://pipe.u.isucon.dev:443")
}
for _, server := range job.Servers {
benchOptions = append(benchOptions, "--webapp")
benchOptions = append(benchOptions, server)
}
log.Printf("benchmark options = %+v\n", benchOptions)

var stdout, stderr bytes.Buffer
Expand Down
8 changes: 7 additions & 1 deletion bench/scenario/viewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ import (
"errors"
"math/rand"
"net/http"
"sync"

"github.com/isucon/isucon13/bench/internal/bencherror"
"github.com/isucon/isucon13/bench/internal/scheduler"
"github.com/isucon/isucon13/bench/isupipe"
"go.uber.org/zap"
)

var basicViewerScenarioRandSource = rand.New(rand.NewSource(63877281473681))
var (
basicViewerScenarioRandSourceMu sync.Mutex
basicViewerScenarioRandSource = rand.New(rand.NewSource(63877281473681))
)

func BasicViewerScenario(
ctx context.Context,
Expand All @@ -21,7 +25,9 @@ func BasicViewerScenario(
livestreamPool *isupipe.LivestreamPool,
) error {
lgr := zap.S()
basicViewerScenarioRandSourceMu.Lock()
n := basicViewerScenarioRandSource.Int()
basicViewerScenarioRandSourceMu.Unlock()

lgr.Info("basic viewer scenario")
client, err := viewerPool.Get(ctx)
Expand Down

0 comments on commit 7bb0ffa

Please sign in to comment.