Skip to content

Commit

Permalink
fix expire over max value (#50) (#61)
Browse files Browse the repository at this point in the history
Signed-off-by: catcherwong <catcher_hwq@outlook.com>
  • Loading branch information
catcherwong authored Jul 13, 2024
1 parent c3b911d commit b9dd44c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/version.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>

<RDBParserVersion>0.9.2</RDBParserVersion>
<RDBCliVersion>0.9.2</RDBCliVersion>
<RDBParserVersion>0.9.3</RDBParserVersion>
<RDBCliVersion>0.9.3</RDBCliVersion>

</PropertyGroup>
</Project>
6 changes: 5 additions & 1 deletion src/RDBCli/Helpers/CommonHelper.Func.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ internal static string GetExpireString(long exp)
{
var res = exp.ToString();

if (exp > 0)
if (exp >= RDBParser.Constant.MaxExpireTimestamp)
{
res = ">7d";
}
else if (exp > 0)
{
var sub = DateTimeOffset.FromUnixTimeMilliseconds(exp).Subtract(DateTimeOffset.UtcNow);

Expand Down
2 changes: 1 addition & 1 deletion src/RDBParser/BinaryReaderRDBParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private bool MatchFilter(int database = -1, int dataType = -1, byte[] key = null

if (_filter.IsExpired.HasValue)
{
if (_expiry == 0)
if (_expiry == 0 || _expiry >= Constant.MaxExpireTimestamp)
{
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/RDBParser/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{
public static class Constant
{
// 9999-12-31 23:59:59
public static long MaxExpireTimestamp = 253402300799999;

public static class RdbVersion
{
public const int Min = 1;
Expand Down

0 comments on commit b9dd44c

Please sign in to comment.