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

Commitef15df1

Browse files
committed
move release to only if err == nil
1 parent4ea0165 commitef15df1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎coderd/parameters.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ func (api *API) handleDynamicParameters(rw http.ResponseWriter, r *http.Request,
101101

102102
// Add the file first. Calling `Release` if it fails is a no-op, so this is safe.
103103
templateFS,err:=api.FileCache.Acquire(fileCtx,fileID)
104-
deferapi.FileCache.Release(fileID)
105104
iferr!=nil {
106105
httpapi.Write(ctx,rw,http.StatusNotFound, codersdk.Response{
107106
Message:"Internal error fetching template version Terraform.",
108107
Detail:err.Error(),
109108
})
110109
return
111110
}
111+
deferapi.FileCache.Release(fileID)
112112

113113
// Having the Terraform plan available for the evaluation engine is helpful
114114
// for populating values from data blocks, but isn't strictly required. If
@@ -120,14 +120,14 @@ func (api *API) handleDynamicParameters(rw http.ResponseWriter, r *http.Request,
120120

121121
iftf.CachedModuleFiles.Valid {
122122
moduleFilesFS,err:=api.FileCache.Acquire(fileCtx,tf.CachedModuleFiles.UUID)
123-
deferapi.FileCache.Release(tf.CachedModuleFiles.UUID)
124123
iferr!=nil {
125124
httpapi.Write(ctx,rw,http.StatusNotFound, codersdk.Response{
126125
Message:"Internal error fetching Terraform modules.",
127126
Detail:err.Error(),
128127
})
129128
return
130129
}
130+
deferapi.FileCache.Release(tf.CachedModuleFiles.UUID)
131131

132132
templateFS=files.NewOverlayFS(templateFS, []files.Overlay{{Path:".terraform/modules",FS:moduleFilesFS}})
133133
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp