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

Updating a DateTime value results in detecting changes and setting all other DateTime values #477

Open
ahmedisam99 opened this issue Aug 28, 2024 · 2 comments

Comments

@ahmedisam99
Copy link
Contributor

ahmedisam99 commented Aug 28, 2024

Check out the following code snippet:

public async Task UpdateLastActivityAsync()
{
    CheckSessionNotNull();

    _session!.LastActivity = DateTime.UtcNow;
    await _sessionCollection.SaveAsync();
    // await _sessionCollection.UpdateAsync(_session);
}

This results in the following command(s) (for both SaveAsync and UpdateAsync:

21:30:11.982 [0 172.17.0.1:57826] "SCRIPT" "LOAD" "local key = KEYS[1]\nlocal num_args = table.getn(ARGV)\nfor i=1, num_args, 3 do\n if 'ARRREM' == ARGV[i] then\n local index = redis.call('JSON.ARRINDEX', key, ARGV[i+1], ARGV[i+2])[1]\n if index>=0 then\n redis.call('JSON.ARRPOP', key, ARGV[i+1], index)\n end\n else\n if 'DEL' == ARGV[i] then\n redis.call('JSON.DEL',key,ARGV[i+1])\n else\n redis.call(string.format('JSON.%s', ARGV[i]), key, ARGV[i+1], ARGV[i+2])\n end\n end\nend\n"
21:30:12.501 [0 172.17.0.1:57826] "SELECT" "0"
21:30:12.501 [0 172.17.0.1:57826] "EVALSHA" "118f0eee57ae15ddfd37bd680e8002358aaf7161" "1" "TenTime:Session:01919863-306c-f263-bf63-92a58c41940d" "SET" "$.Profile.Birthdate" "-560044800000" "SET" "$.CreatedAt" "1724838522988" "SET" "$.LastActivity" "1724870179493"

21:30:12.501 [0 lua] "JSON.SET" "TenTime:Session:01919863-306c-f263-bf63-92a58c41940d" "$.Profile.Birthdate" "-560044800000"
21:30:12.502 [0 lua] "JSON.SET" "TenTime:Session:01919863-306c-f263-bf63-92a58c41940d" "$.CreatedAt" "1724838522988"
21:30:12.502 [0 lua] "JSON.SET" "TenTime:Session:01919863-306c-f263-bf63-92a58c41940d" "$.LastActivity" "1724870179493"

Notice the last 3 commands, where trying to set $.Profile.Birthdate, $.CreatedAt, and $.LastActivity, even though the only value actually changed is LastActivity

Note that the negative value for Profile.Birthdate indicates a date before the UNIX epoch (01/01/1970)

@ahmedisam99
Copy link
Contributor Author

@slorello89
Need you support here ☝️

@granit1986
Copy link

I try to fix this issue in 471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants