Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
4d794dae
Commit
4d794dae
authored
5 years ago
by
Brendan Abolivier
Browse files
Options
Downloads
Patches
Plain Diff
Move delta from +10% to -10%
parent
6bfc5ad3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/config/registration.py
+1
-1
1 addition, 1 deletion
synapse/config/registration.py
synapse/storage/_base.py
+2
-2
2 additions, 2 deletions
synapse/storage/_base.py
tests/rest/client/v2_alpha/test_register.py
+2
-2
2 additions, 2 deletions
tests/rest/client/v2_alpha/test_register.py
with
5 additions
and
5 deletions
synapse/config/registration.py
+
1
−
1
View file @
4d794dae
...
...
@@ -132,7 +132,7 @@ class RegistrationConfig(Config):
# then derive an expiration date from the current validity period), and some time
# after that the validity period changes and Synapse is restarted, the users
'
# expiration dates won
'
t be updated unless their account is manually renewed. This
# date will be randomly selected within a range [now + period ; now + period
+ d
],
# date will be randomly selected within a range [now + period
- d
; now + period],
# where d is equal to 10%% of the validity period.
#
#account_validity:
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/_base.py
+
2
−
2
View file @
4d794dae
...
...
@@ -329,7 +329,7 @@ class SQLBaseStore(object):
user_id (str): User ID to set an expiration date for.
use_delta (bool): If set to False, the expiration date for the user will be
now + validity period. If set to True, this expiration date will be a
random value in the [now + period; now + period
+ d
] range, d being a
random value in the [now + period
- d
; now + period] range, d being a
delta equal to 10% of the validity period.
"""
now_ms
=
self
.
_clock
.
time_msec
()
...
...
@@ -337,8 +337,8 @@ class SQLBaseStore(object):
if
use_delta
:
expiration_ts
=
self
.
rand
.
randrange
(
expiration_ts
-
self
.
_account_validity
.
startup_job_max_delta
,
expiration_ts
,
expiration_ts
+
self
.
_account_validity
.
startup_job_max_delta
,
)
self
.
_simple_insert_txn
(
...
...
This diff is collapsed.
Click to expand it.
tests/rest/client/v2_alpha/test_register.py
+
2
−
2
View file @
4d794dae
...
...
@@ -467,5 +467,5 @@ class AccountValidityBackgroundJobTestCase(unittest.HomeserverTestCase):
res
=
self
.
get_success
(
self
.
store
.
get_expiration_ts_for_user
(
user_id
))
self
.
assert
Less
Equal
(
res
,
now_ms
+
self
.
validity_period
+
self
.
max_delta
)
self
.
assert
Greater
Equal
(
res
,
now_ms
+
self
.
validity_period
)
self
.
assert
Greater
Equal
(
res
,
now_ms
+
self
.
validity_period
-
self
.
max_delta
)
self
.
assert
Less
Equal
(
res
,
now_ms
+
self
.
validity_period
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment