From df1a495ab9072f3df914baf67e1b5a2a148335f0 Mon Sep 17 00:00:00 2001 From: eric <1048315650@qq.com> Date: Wed, 24 Jul 2024 16:24:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(xmsgbus):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=A0=8A=20msgbus=20=E8=87=AA=E5=B8=A6=20*=20=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xmsgbus/impl/redis/storage.go | 6 +++++- xmsgbus/topicmanager.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xmsgbus/impl/redis/storage.go b/xmsgbus/impl/redis/storage.go index 53c394a..37f7f6b 100644 --- a/xmsgbus/impl/redis/storage.go +++ b/xmsgbus/impl/redis/storage.go @@ -2,6 +2,7 @@ package redis import ( "context" + "strings" "time" "github.com/ccheers/xpkg/xmsgbus" @@ -21,7 +22,10 @@ func (x *SharedStorage) SetEx(ctx context.Context, key string, value interface{} } func (x *SharedStorage) Keys(ctx context.Context, prefix string) ([]string, error) { - return x.client.Keys(ctx, prefix+"*").Result() + if !strings.HasSuffix(prefix, "*") { + prefix += "*" + } + return x.client.Keys(ctx, prefix).Result() } func (x *SharedStorage) Del(ctx context.Context, key string) error { diff --git a/xmsgbus/topicmanager.go b/xmsgbus/topicmanager.go index 1b054f9..f029c6e 100644 --- a/xmsgbus/topicmanager.go +++ b/xmsgbus/topicmanager.go @@ -135,7 +135,7 @@ func (x *TopicManager) check(ctx context.Context, topic string) { } for _, channel := range channels { - results, err := x.storage.Keys(ctx, x.subKeyPrefix(topic, channel)+"*") + results, err := x.storage.Keys(ctx, x.subKeyPrefix(topic, channel)) if err != nil { _ = xlogger.DefaultLogger.Log(xlogger.LevelError, "err", err, From 10d54f55f477fb1277c895be74beed6c8e7014d9 Mon Sep 17 00:00:00 2001 From: eric <1048315650@qq.com> Date: Wed, 24 Jul 2024 16:49:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(workflows):=20go=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8ef5f3e..7f1ef7a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,7 +12,7 @@ jobs: ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 strategy: matrix: - go-version: [1.19.x] + go-version: [1.21.x, 1.22.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: