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

Commit620eecd

Browse files
committed
apply review suggestions
1 parente24bb10 commit620eecd

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
@@ -1779,10 +1779,10 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
17791779

17801780
_,_=fmt.Fprintln(inv.Stderr,"Creating users...")
17811781

1782-
ownerDialBarrier:=&sync.WaitGroup{}
1783-
regularDialBarrier:=&sync.WaitGroup{}
1784-
ownerDialBarrier.Add(int(ownerUserCount))
1785-
regularDialBarrier.Add(int(regularUserCount))
1782+
dialBarrier:=&sync.WaitGroup{}
1783+
ownerWatchBarrier:=&sync.WaitGroup{}
1784+
dialBarrier.Add(int(userCount))
1785+
ownerWatchBarrier.Add(int(ownerUserCount))
17861786

17871787
expectedNotifications:=map[uuid.UUID]chan time.Time{
17881788
notificationsLib.TemplateUserAccountCreated:make(chan time.Time,1),
@@ -1795,10 +1795,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
17951795
User: createusers.Config{
17961796
OrganizationID:me.OrganizationIDs[0],
17971797
},
1798-
IsOwner:true,
1798+
Roles: []string{codersdk.RoleOwner},
17991799
NotificationTimeout:notificationTimeout,
18001800
DialTimeout:dialTimeout,
1801-
DialBarrier:ownerDialBarrier,
1801+
DialBarrier:dialBarrier,
1802+
OwnerWatchBarrier:ownerWatchBarrier,
18021803
ExpectedNotifications:expectedNotifications,
18031804
Metrics:metrics,
18041805
}
@@ -1812,11 +1813,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
18121813
User: createusers.Config{
18131814
OrganizationID:me.OrganizationIDs[0],
18141815
},
1815-
IsOwner:false,
1816+
Roles: []string{},
18161817
NotificationTimeout:notificationTimeout,
18171818
DialTimeout:dialTimeout,
1818-
DialBarrier:regularDialBarrier,
1819-
OwnerDialBarrier:ownerDialBarrier,
1819+
DialBarrier:dialBarrier,
1820+
OwnerWatchBarrier:ownerWatchBarrier,
18201821
Metrics:metrics,
18211822
}
18221823
iferr:=config.Validate();err!=nil {
@@ -1830,8 +1831,7 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
18301831
logger,
18311832
client,
18321833
me.OrganizationIDs[0],
1833-
ownerDialBarrier,
1834-
regularDialBarrier,
1834+
dialBarrier,
18351835
dialTimeout,
18361836
expectedNotifications,
18371837
)
@@ -2145,60 +2145,34 @@ func triggerUserNotifications(
21452145
logger slog.Logger,
21462146
client*codersdk.Client,
21472147
orgID uuid.UUID,
2148-
ownerDialBarrier*sync.WaitGroup,
2149-
regularDialBarrier*sync.WaitGroup,
2148+
dialBarrier*sync.WaitGroup,
21502149
dialTimeout time.Duration,
21512150
expectedNotificationsmap[uuid.UUID]chan time.Time,
21522151
) {
2153-
logger.Info(ctx,"waiting forowner users to connect")
2152+
logger.Info(ctx,"waiting forall users to connect")
21542153

2155-
// Wait forowner users to connect
2156-
ownerWaitCtx,cancel:=context.WithTimeout(ctx,dialTimeout+30*time.Second)
2154+
// Wait forall users to connect
2155+
waitCtx,cancel:=context.WithTimeout(ctx,dialTimeout+30*time.Second)
21572156
defercancel()
21582157

2159-
ownerDone:=make(chanstruct{})
2158+
done:=make(chanstruct{})
21602159
gofunc() {
2161-
ownerDialBarrier.Wait()
2162-
close(ownerDone)
2160+
dialBarrier.Wait()
2161+
close(done)
21632162
}()
21642163

21652164
select {
2166-
case<-ownerDone:
2167-
logger.Info(ctx,"allownerusers connected")
2168-
case<-ownerWaitCtx.Done():
2169-
ifownerWaitCtx.Err()==context.DeadlineExceeded {
2170-
logger.Error(ctx,"timeout waiting forownerusers to connect")
2165+
case<-done:
2166+
logger.Info(ctx,"all users connected")
2167+
case<-waitCtx.Done():
2168+
ifwaitCtx.Err()==context.DeadlineExceeded {
2169+
logger.Error(ctx,"timeout waiting for users to connect")
21712170
}else {
2172-
logger.Info(ctx,"context canceled while waiting forownerusers")
2171+
logger.Info(ctx,"context canceled while waiting for users")
21732172
}
21742173
return
21752174
}
21762175

2177-
// Wait for regular users to connect
2178-
logger.Info(ctx,"waiting for regular users to connect")
2179-
regularWaitCtx,cancel:=context.WithTimeout(ctx,dialTimeout+30*time.Second)
2180-
defercancel()
2181-
2182-
regularDone:=make(chanstruct{})
2183-
gofunc() {
2184-
regularDialBarrier.Wait()
2185-
close(regularDone)
2186-
}()
2187-
2188-
select {
2189-
case<-regularDone:
2190-
logger.Info(ctx,"all regular users connected")
2191-
case<-regularWaitCtx.Done():
2192-
ifregularWaitCtx.Err()==context.DeadlineExceeded {
2193-
logger.Error(ctx,"timeout waiting for regular users to connect")
2194-
}else {
2195-
logger.Info(ctx,"context canceled while waiting for regular users")
2196-
}
2197-
return
2198-
}
2199-
2200-
logger.Info(ctx,"all users connected, triggering notifications")
2201-
22022176
const (
22032177
triggerUsername="scaletest-trigger-user"
22042178
triggerEmail="scaletest-trigger@example.com"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp