This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v1.0 by this push:
new b8fa7ba1c fix(zentao): make sure connection uncacheable (#8245) (#8247)
b8fa7ba1c is described below
commit b8fa7ba1c7e815dca2cf4ce915d2db71da37f3e6
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Dec 18 15:51:41 2024 +0800
fix(zentao): make sure connection uncacheable (#8245) (#8247)
* fix(zentao): make sure connection uncacheable
* fix(zentao): fix lint errors
* Revert "fix(zentao): fix lint errors"
This reverts commit e216a23ac1fdb0cb2297fc1bfb8e88abb0da9a90.
* fix(zentao): fix lint errors
* fix(zentao): remove UnCacheableConnetion interface, try to fix it with
another way
Co-authored-by: Lynwee <[email protected]>
---
backend/helpers/pluginhelper/api/ds_remote_api_proxy_api.go | 6 +-----
backend/plugins/zentao/models/connection.go | 9 +++++++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/backend/helpers/pluginhelper/api/ds_remote_api_proxy_api.go
b/backend/helpers/pluginhelper/api/ds_remote_api_proxy_api.go
index 9ea8b5d2a..b0c4b0439 100644
--- a/backend/helpers/pluginhelper/api/ds_remote_api_proxy_api.go
+++ b/backend/helpers/pluginhelper/api/ds_remote_api_proxy_api.go
@@ -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"),
diff --git a/backend/plugins/zentao/models/connection.go
b/backend/plugins/zentao/models/connection.go
index 0554450e7..949dd36d2 100644
--- a/backend/plugins/zentao/models/connection.go
+++ b/backend/plugins/zentao/models/connection.go
@@ -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 != "" {
@@ -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