Skip to content

Commit c386885

Browse files
committed
windows:|
1 parent 337525a commit c386885

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

coderd/files/cache.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ func (c *Cache) Acquire(ctx context.Context, fileID uuid.UUID) (fs.FS, error) {
6363
// mutex has been released, or we would continue to hold the lock until the
6464
// entire file has been fetched, which may be slow, and would prevent other
6565
// files from being fetched in parallel.
66-
return c.prepare(ctx, fileID).Load()
66+
it, err := c.prepare(ctx, fileID).Load()
67+
if err != nil {
68+
c.Release(fileID)
69+
}
70+
return it, err
6771
}
6872

6973
func (c *Cache) prepare(ctx context.Context, fileID uuid.UUID) *lazy.ValueWithError[fs.FS] {

coderd/parameters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ func (api *API) templateVersionDynamicParameters(rw http.ResponseWriter, r *http
6969
}
7070

7171
fs, err := api.FileCache.Acquire(fileCtx, fileID)
72-
defer api.FileCache.Release(fileID)
7372
if err != nil {
7473
httpapi.Write(ctx, rw, http.StatusNotFound, codersdk.Response{
7574
Message: "Internal error fetching template version Terraform.",
7675
Detail: err.Error(),
7776
})
7877
return
7978
}
79+
defer api.FileCache.Release(fileID)
8080

8181
// Having the Terraform plan available for the evaluation engine is helpful
8282
// for populating values from data blocks, but isn't strictly required. If

provisioner/terraform/modules_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestGetModulesArchive(t *testing.T) {
5555
if runtime.GOOS != "windows" {
5656
require.Equal(t, "05d2994c1a50ce573fe2c2b29507e5131ba004d15812d8bb0a46dc732f3211f5", hash)
5757
} else {
58-
require.Equal(t, "09a30ffc30138f9a411b280ef4581dcf22ffab8f0ca9de982329226400ec8520", hash)
58+
require.Equal(t, "c219943913051e4637527cd03ae2b7303f6945005a262cdd420f9c2af490d572", hash)
5959
}
6060
})
6161

0 commit comments

Comments
 (0)