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

Commit877854a

Browse files
authored
fix: Display proper access URL on server start (#1172)
Fixes#1170.
1 parent29d5588 commit877854a

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

‎cli/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func server() *cobra.Command {
293293
if!hasFirstUser&&err==nil {
294294
// This could fail for a variety of TLS-related reasons.
295295
// This is a helpful starter message, and not critical for user interaction.
296-
_,_=fmt.Fprint(cmd.ErrOrStderr(),cliui.Styles.Paragraph.Render(cliui.Styles.Wrap.Render(cliui.Styles.FocusedPrompt.String()+`Run `+cliui.Styles.Code.Render("coder login "+client.URL.String())+" in a new terminal to get started.\n")))
296+
_,_=fmt.Fprint(cmd.ErrOrStderr(),cliui.Styles.Paragraph.Render(cliui.Styles.Wrap.Render(cliui.Styles.FocusedPrompt.String()+`Run `+cliui.Styles.Code.Render("coder login "+accessURL)+" in a new terminal to get started.\n")))
297297
}
298298
}
299299

‎provisionerd/provisionerd.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ type Server struct {
9999
shutdownchanstruct{}
100100

101101
// Locked when acquiring or failing a job.
102-
jobMutex sync.Mutex
103-
jobIDstring
104-
jobRunningchanstruct{}
105-
jobFailed atomic.Bool
106-
jobCancel context.CancelFunc
102+
jobMutex sync.Mutex
103+
jobIDstring
104+
jobRunningMutex sync.Mutex
105+
jobRunningchanstruct{}
106+
jobFailed atomic.Bool
107+
jobCancel context.CancelFunc
107108
}
108109

109110
// Connect establishes a connection to coderd.
@@ -116,13 +117,10 @@ func (p *Server) connect(ctx context.Context) {
116117
iferrors.Is(err,context.Canceled) {
117118
return
118119
}
119-
p.closeMutex.Lock()
120120
ifp.isClosed() {
121-
p.closeMutex.Unlock()
122121
return
123122
}
124123
p.opts.Logger.Warn(context.Background(),"failed to dial",slog.Error(err))
125-
p.closeMutex.Unlock()
126124
continue
127125
}
128126
p.clientValue.Store(client)
@@ -230,11 +228,10 @@ func (p *Server) acquireJob(ctx context.Context) {
230228
ifjob.JobId=="" {
231229
return
232230
}
233-
ifp.isClosed() {
234-
return
235-
}
236231
ctx,p.jobCancel=context.WithCancel(ctx)
232+
p.jobRunningMutex.Lock()
237233
p.jobRunning=make(chanstruct{})
234+
p.jobRunningMutex.Unlock()
238235
p.jobFailed.Store(false)
239236
p.jobID=job.JobId
240237

@@ -938,7 +935,9 @@ func (p *Server) closeWithError(err error) error {
938935
errMsg=err.Error()
939936
}
940937
p.failActiveJobf(errMsg)
938+
p.jobRunningMutex.Lock()
941939
<-p.jobRunning
940+
p.jobRunningMutex.Unlock()
942941
p.closeCancel()
943942

944943
p.opts.Logger.Debug(context.Background(),"closing server with error",slog.Error(err))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp