Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit241c3b8

Browse files
committed
apply review suggestions
1 parent1f7148e commit241c3b8

File tree

1 file changed

+24
-50
lines changed

1 file changed

+24
-50
lines changed

‎cli/exp_scaletest.go‎

Lines changed: 24 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,10 +2014,10 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
20142014

20152015
_,_=fmt.Fprintln(inv.Stderr,"Creating users...")
20162016

2017-
ownerDialBarrier:=&sync.WaitGroup{}
2018-
regularDialBarrier:=&sync.WaitGroup{}
2019-
ownerDialBarrier.Add(int(ownerUserCount))
2020-
regularDialBarrier.Add(int(regularUserCount))
2017+
dialBarrier:=&sync.WaitGroup{}
2018+
ownerWatchBarrier:=&sync.WaitGroup{}
2019+
dialBarrier.Add(int(userCount))
2020+
ownerWatchBarrier.Add(int(ownerUserCount))
20212021

20222022
expectedNotifications:=map[uuid.UUID]chan time.Time{
20232023
notificationsLib.TemplateUserAccountCreated:make(chan time.Time,1),
@@ -2030,10 +2030,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
20302030
User: createusers.Config{
20312031
OrganizationID:me.OrganizationIDs[0],
20322032
},
2033-
IsOwner:true,
2033+
Roles: []string{codersdk.RoleOwner},
20342034
NotificationTimeout:notificationTimeout,
20352035
DialTimeout:dialTimeout,
2036-
DialBarrier:ownerDialBarrier,
2036+
DialBarrier:dialBarrier,
2037+
OwnerWatchBarrier:ownerWatchBarrier,
20372038
ExpectedNotifications:expectedNotifications,
20382039
Metrics:metrics,
20392040
}
@@ -2047,11 +2048,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
20472048
User: createusers.Config{
20482049
OrganizationID:me.OrganizationIDs[0],
20492050
},
2050-
IsOwner:false,
2051+
Roles: []string{},
20512052
NotificationTimeout:notificationTimeout,
20522053
DialTimeout:dialTimeout,
2053-
DialBarrier:regularDialBarrier,
2054-
OwnerDialBarrier:ownerDialBarrier,
2054+
DialBarrier:dialBarrier,
2055+
OwnerWatchBarrier:ownerWatchBarrier,
20552056
Metrics:metrics,
20562057
}
20572058
iferr:=config.Validate();err!=nil {
@@ -2065,8 +2066,7 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
20652066
logger,
20662067
client,
20672068
me.OrganizationIDs[0],
2068-
ownerDialBarrier,
2069-
regularDialBarrier,
2069+
dialBarrier,
20702070
dialTimeout,
20712071
expectedNotifications,
20722072
)
@@ -2380,60 +2380,34 @@ func triggerUserNotifications(
23802380
logger slog.Logger,
23812381
client*codersdk.Client,
23822382
orgID uuid.UUID,
2383-
ownerDialBarrier*sync.WaitGroup,
2384-
regularDialBarrier*sync.WaitGroup,
2383+
dialBarrier*sync.WaitGroup,
23852384
dialTimeout time.Duration,
23862385
expectedNotificationsmap[uuid.UUID]chan time.Time,
23872386
) {
2388-
logger.Info(ctx,"waiting forowner users to connect")
2387+
logger.Info(ctx,"waiting forall users to connect")
23892388

2390-
// Wait forowner users to connect
2391-
ownerWaitCtx,cancel:=context.WithTimeout(ctx,dialTimeout+30*time.Second)
2389+
// Wait forall users to connect
2390+
waitCtx,cancel:=context.WithTimeout(ctx,dialTimeout+30*time.Second)
23922391
defercancel()
23932392

2394-
ownerDone:=make(chanstruct{})
2393+
done:=make(chanstruct{})
23952394
gofunc() {
2396-
ownerDialBarrier.Wait()
2397-
close(ownerDone)
2395+
dialBarrier.Wait()
2396+
close(done)
23982397
}()
23992398

24002399
select {
2401-
case<-ownerDone:
2402-
logger.Info(ctx,"allownerusers connected")
2403-
case<-ownerWaitCtx.Done():
2404-
ifownerWaitCtx.Err()==context.DeadlineExceeded {
2405-
logger.Error(ctx,"timeout waiting forownerusers to connect")
2400+
case<-done:
2401+
logger.Info(ctx,"all users connected")
2402+
case<-waitCtx.Done():
2403+
ifwaitCtx.Err()==context.DeadlineExceeded {
2404+
logger.Error(ctx,"timeout waiting for users to connect")
24062405
}else {
2407-
logger.Info(ctx,"context canceled while waiting forownerusers")
2406+
logger.Info(ctx,"context canceled while waiting for users")
24082407
}
24092408
return
24102409
}
24112410

2412-
// Wait for regular users to connect
2413-
logger.Info(ctx,"waiting for regular users to connect")
2414-
regularWaitCtx,cancel:=context.WithTimeout(ctx,dialTimeout+30*time.Second)
2415-
defercancel()
2416-
2417-
regularDone:=make(chanstruct{})
2418-
gofunc() {
2419-
regularDialBarrier.Wait()
2420-
close(regularDone)
2421-
}()
2422-
2423-
select {
2424-
case<-regularDone:
2425-
logger.Info(ctx,"all regular users connected")
2426-
case<-regularWaitCtx.Done():
2427-
ifregularWaitCtx.Err()==context.DeadlineExceeded {
2428-
logger.Error(ctx,"timeout waiting for regular users to connect")
2429-
}else {
2430-
logger.Info(ctx,"context canceled while waiting for regular users")
2431-
}
2432-
return
2433-
}
2434-
2435-
logger.Info(ctx,"all users connected, triggering notifications")
2436-
24372411
const (
24382412
triggerUsername="scaletest-trigger-user"
24392413
triggerEmail="scaletest-trigger@example.com"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp