dont update the auth token twice#1037
Conversation
| @@ -609,7 +609,6 @@ private function checkTokenCredentials(IToken $dbToken, $token) { | |||
| return false; | |||
| } | |||
| $dbToken->setLastCheck($now); | |||
There was a problem hiding this comment.
is that one then required at all?
There was a problem hiding this comment.
yes, otherwise the checks are performed on every request, see above
if ($lastCheck > ($now - 60 * 5)) {
// Checked performed recently, nothing to do now
return true;
}|
Hm, |
|
if only the activity was updated recently, the update would be ignored then. See server/lib/private/Authentication/Token/DefaultTokenProvider.php Lines 107 to 124 in 42ef336 |
|
since The only "loss" is that |
def7f7d to
9810907
Compare
|
I agree with @icewind1991 that lagging behind a bit is not that big of a deal. If it is max 1 minute. Fine by me. But I also agree with @ChristophWurst that we should not depend on dark magic. So please make sure it is properly tested. Will take a more in depth look tomorrow. |
Tomorrow is over 😉 |
True ;) I'm still torn. I like the improvement but I feel this will break once somebody at some point moves code around. So can we have unit tests for this behaviour? Then it is 🚀 for me! |
@icewind1991 Could you add unit tests for this? Thanks |
9810907 to
f89bc0a
Compare
|
Added tests to ensure the token times are updated |
|
Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
ab458d9 to
90db361
Compare
|
Tested and works 👍 |
Current coverage is 56.39% (diff: 100%)@@ master #1037 diff @@
==========================================
Files 1070 1070
Lines 60432 60490 +58
Methods 6817 6825 +8
Messages 0 0
Branches 0 0
==========================================
+ Hits 34087 34111 +24
- Misses 26345 26379 +34
Partials 0 0
|
|
ok test. Fine by me. LGTM then. |
|
👍 I guess 🙈 |
The token is already updated in
updateTokenActivitySaves an update query for each request made
stacktraces for both queries on master:
cc @ChristophWurst