Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(zentao): make sure connection uncacheable #8245

Merged
merged 6 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions backend/helpers/pluginhelper/api/ds_remote_api_proxy_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ type DsRemoteApiProxyHelper[C plugin.ToolLayerApiConnection] struct {
}

// NewDsRemoteApiProxyHelper creates a new DsRemoteApiProxyHelper
func NewDsRemoteApiProxyHelper[
C plugin.ToolLayerApiConnection,
](
modelApiHelper *ModelApiHelper[C],
) *DsRemoteApiProxyHelper[C] {
func NewDsRemoteApiProxyHelper[C plugin.ToolLayerApiConnection](modelApiHelper *ModelApiHelper[C]) *DsRemoteApiProxyHelper[C] {
return &DsRemoteApiProxyHelper[C]{
ModelApiHelper: modelApiHelper,
logger: modelApiHelper.basicRes.GetLogger().Nested("remote_api_helper"),
Expand Down
9 changes: 9 additions & 0 deletions backend/plugins/zentao/models/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ type ZentaoConn struct {
DbMaxConns int `json:"dbMaxConns" mapstructure:"dbMaxConns"`
}

func (connection ZentaoConn) GetHash() string {
// zentao's token will expire after about 24min, so api client cannot be cached.
return ""
}

func (connection ZentaoConn) Sanitize() ZentaoConn {
connection.Password = ""
if connection.DbUrl != "" {
Expand Down Expand Up @@ -106,6 +111,10 @@ func (connection ZentaoConn) SanitizeDbUrl() string {
return dbUrl
}

func (connection ZentaoConnection) GetHash() string {
return connection.ZentaoConn.GetHash()
}

func (connection ZentaoConnection) Sanitize() ZentaoConnection {
connection.ZentaoConn = connection.ZentaoConn.Sanitize()
return connection
Expand Down
Loading