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

Commit3a98bbb

Browse files
committed
fixup! fix tests
1 parent86d66b1 commit3a98bbb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎codersdk/toolsdk/toolsdk.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ func WithCleanContext(h GenericHandlerFunc) GenericHandlerFunc {
156156
returnfunc(parent context.Context,tbDeps,args json.RawMessage) (ret json.RawMessage,errerror) {
157157
child,childCancel:=context.WithCancel(context.Background())
158158
deferchildCancel()
159+
// Ensure that the child context has the same deadline as the parent
160+
// context.
161+
ifdeadline,ok:=parent.Deadline();ok {
162+
deadlineCtx,deadlineCancel:=context.WithDeadline(child,deadline)
163+
deferdeadlineCancel()
164+
child=deadlineCtx
165+
}
159166
// Ensure that cancellation propagates from the parent context to the child context.
160167
gofunc() {
161168
select {
@@ -165,13 +172,6 @@ func WithCleanContext(h GenericHandlerFunc) GenericHandlerFunc {
165172
childCancel()
166173
}
167174
}()
168-
// Also ensure that the child context has the same deadline as the parent
169-
// context.
170-
ifdeadline,ok:=parent.Deadline();ok {
171-
deadlineCtx,deadlineCancel:=context.WithDeadline(child,deadline)
172-
deferdeadlineCancel()
173-
child=deadlineCtx
174-
}
175175
returnh(child,tb,args)
176176
}
177177
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp