Skip to content

Commit

Permalink
Do not cache large schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Dec 21, 2023
1 parent 6eda6dd commit d2d0c16
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions patches/0037-Do-not-cache-large-schemas.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Anton Tayanovskyy <[email protected]>
Date: Thu, 21 Dec 2023 13:05:17 -0600
Subject: [PATCH 37/37] Do not cache large schemas


diff --git a/shim/shim.go b/shim/shim.go
index 9ef51a5245..b94f722d26 100644
--- a/shim/shim.go
+++ b/shim/shim.go
@@ -3,7 +3,6 @@ package shim
import (
"context"
"fmt"
- "sync"

pfprovider "github.com/hashicorp/terraform-plugin-framework/provider"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -57,13 +56,8 @@ func markTagsAllNotComputedForResource(rn string, r *schema.Resource) *schema.Re
u := *r
if r.SchemaFunc != nil {
old := r.SchemaFunc
- var once sync.Once
- var cache map[string]*schema.Schema
u.SchemaFunc = func() map[string]*schema.Schema {
- once.Do(func() {
- cache = markTagsAllNotComputedForSchema(rn, old())
- })
- return cache
+ return markTagsAllNotComputedForSchema(rn, old())
}
} else {
u.Schema = markTagsAllNotComputedForSchema(rn, r.Schema)

0 comments on commit d2d0c16

Please sign in to comment.