From 89ace0413f6bc263a6a06ff1576c6485019cc284 Mon Sep 17 00:00:00 2001 From: JasonZhiZhi Date: Wed, 23 Oct 2024 18:55:29 +0800 Subject: [PATCH] feat(*): redis message key --- docs | 2 +- pkg/gen_id/const.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs b/docs index ac720c9..2b9cdf5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ac720c9e44801e7ce6cda70b96a95cbcdf312b34 +Subproject commit 2b9cdf56f708e5c548edeb2d76a5a8de9fe0230f diff --git a/pkg/gen_id/const.go b/pkg/gen_id/const.go index b3d5892..84e1d4a 100644 --- a/pkg/gen_id/const.go +++ b/pkg/gen_id/const.go @@ -12,8 +12,10 @@ const ( // msg_id const ( // 计算:相对时间戳 - baseTimeStampOffset = 1677004307 // 2023-02-22 02:31:47 - expireMsgKey = 2 * time.Second // 生成 msg_id 时,redis key的有效期(2秒) + baseTimeStampOffset = 1677004307 // 2023-02-22 02:31:47 + // 生成 msg_id 时,redis key的有效期(5秒) + // 需要考虑:时间回退的问题、过期key淘汰 + expireMsgKey = 5 * time.Second ) // version_id