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
Package registry
Container registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
af92f5b0
Commit
af92f5b0
authored
7 years ago
by
Erik Johnston
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Add jitter to validity period of attestations"
parent
b1e62d4a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/groups/attestations.py
+1
-12
1 addition, 12 deletions
synapse/groups/attestations.py
with
1 addition
and
12 deletions
synapse/groups/attestations.py
+
1
−
12
View file @
af92f5b0
...
@@ -13,8 +13,6 @@
...
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
random
from
twisted.internet
import
defer
from
twisted.internet
import
defer
from
synapse.api.errors
import
SynapseError
from
synapse.api.errors
import
SynapseError
...
@@ -27,11 +25,6 @@ from signedjson.sign import sign_json
...
@@ -27,11 +25,6 @@ from signedjson.sign import sign_json
# Default validity duration for new attestations we create
# Default validity duration for new attestations we create
DEFAULT_ATTESTATION_LENGTH_MS
=
3
*
24
*
60
*
60
*
1000
DEFAULT_ATTESTATION_LENGTH_MS
=
3
*
24
*
60
*
60
*
1000
# We add some jitter to the validity duration of attestations so that if we
# add lots of users at once we don't need to renew them all at once.
# The jitter is a multiplier picked randomly between the first and second number
DEFAULT_ATTESTATION_JITTER
=
(
0.9
,
1.3
)
# Start trying to update our attestations when they come this close to expiring
# Start trying to update our attestations when they come this close to expiring
UPDATE_ATTESTATION_TIME_MS
=
1
*
24
*
60
*
60
*
1000
UPDATE_ATTESTATION_TIME_MS
=
1
*
24
*
60
*
60
*
1000
...
@@ -80,14 +73,10 @@ class GroupAttestationSigning(object):
...
@@ -80,14 +73,10 @@ class GroupAttestationSigning(object):
"""
Create an attestation for the group_id and user_id with default
"""
Create an attestation for the group_id and user_id with default
validity length.
validity length.
"""
"""
validity_period
=
DEFAULT_ATTESTATION_LENGTH_MS
validity_period
*=
random
.
uniform
(
*
DEFAULT_ATTESTATION_JITTER
)
valid_until_ms
=
int
(
self
.
clock
.
time_msec
()
+
validity_period
)
return
sign_json
({
return
sign_json
({
"
group_id
"
:
group_id
,
"
group_id
"
:
group_id
,
"
user_id
"
:
user_id
,
"
user_id
"
:
user_id
,
"
valid_until_ms
"
:
valid_until_ms
,
"
valid_until_ms
"
:
self
.
clock
.
time_msec
()
+
DEFAULT_ATTESTATION_LENGTH_MS
,
},
self
.
server_name
,
self
.
signing_key
)
},
self
.
server_name
,
self
.
signing_key
)
...
...
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