Skip to content

Commit

Permalink
Add explicit GRPC call to clear caches/cleanup. Print cache stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreer committed Nov 8, 2024
1 parent 82ace9a commit 93550b1
Show file tree
Hide file tree
Showing 11 changed files with 688 additions and 192 deletions.
464 changes: 303 additions & 161 deletions pb/c1/connector/v2/connector.pb.go

Large diffs are not rendered by default.

274 changes: 274 additions & 0 deletions pb/c1/connector/v2/connector.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions pb/c1/connector/v2/connector_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions pkg/connectorbuilder/connectorbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,6 @@ func (b *builderImpl) ListResourceTypes(
tt := tasks.ListResourceTypesType
var out []*v2.ResourceType

l := ctxzap.Extract(ctx)
// Clear all http caches at the start of a sync. This must be run in the child process, which is why it's in this function and not in syncer.go
err := uhttp.ClearCaches(ctx)
if err != nil {
l.Warn("error clearing http caches", zap.Error(err))
}

for _, rb := range b.resourceBuilders {
out = append(out, rb.ResourceType(ctx))
}
Expand Down Expand Up @@ -800,6 +793,17 @@ func (b *builderImpl) RotateCredential(ctx context.Context, request *v2.RotateCr
}, nil
}

func (b *builderImpl) Cleanup(ctx context.Context, request *v2.ConnectorServiceCleanupRequest) (*v2.ConnectorServiceCleanupResponse, error) {
l := ctxzap.Extract(ctx)
// Clear all http caches at the end of a sync. This must be run in the child process, which is why it's in this function and not in syncer.go
err := uhttp.ClearCaches(ctx)
if err != nil {
l.Warn("error clearing http caches", zap.Error(err))
}
resp := &v2.ConnectorServiceCleanupResponse{}
return resp, err
}

func (b *builderImpl) CreateAccount(ctx context.Context, request *v2.CreateAccountRequest) (*v2.CreateAccountResponse, error) {
start := b.nowFunc()
tt := tasks.CreateAccountType
Expand Down
Loading

0 comments on commit 93550b1

Please sign in to comment.