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
910fc0f2
Commit
910fc0f2
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Add enviroment variable SYNAPSE_CACHE_FACTOR, default it to 0.1
parent
742ec37c
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/handlers/presence.py
+4
-0
4 additions, 0 deletions
synapse/handlers/presence.py
synapse/handlers/receipts.py
+0
-2
0 additions, 2 deletions
synapse/handlers/receipts.py
synapse/util/caches/descriptors.py
+6
-0
6 additions, 0 deletions
synapse/util/caches/descriptors.py
with
10 additions
and
2 deletions
synapse/handlers/presence.py
+
4
−
0
View file @
910fc0f2
...
...
@@ -130,6 +130,10 @@ class PresenceHandler(BaseHandler):
for
state
in
active_presence
}
metrics
.
register_callback
(
"
user_to_current_state_size
"
,
lambda
:
len
(
self
.
user_to_current_state
)
)
now
=
self
.
clock
.
time_msec
()
for
state
in
active_presence
:
self
.
wheel_timer
.
insert
(
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/receipts.py
+
0
−
2
View file @
910fc0f2
...
...
@@ -36,8 +36,6 @@ class ReceiptsHandler(BaseHandler):
)
self
.
clock
=
self
.
hs
.
get_clock
()
self
.
_receipt_cache
=
None
@defer.inlineCallbacks
def
received_client_receipt
(
self
,
room_id
,
receipt_type
,
user_id
,
event_id
):
...
...
This diff is collapsed.
Click to expand it.
synapse/util/caches/descriptors.py
+
6
−
0
View file @
910fc0f2
...
...
@@ -28,6 +28,7 @@ from twisted.internet import defer
from
collections
import
OrderedDict
import
os
import
functools
import
inspect
import
threading
...
...
@@ -38,9 +39,14 @@ logger = logging.getLogger(__name__)
_CacheSentinel
=
object
()
CACHE_SIZE_FACTOR
=
float
(
os
.
environ
.
get
(
"
SYNAPSE_CACHE_FACTOR
"
,
0.1
))
class
Cache
(
object
):
def
__init__
(
self
,
name
,
max_entries
=
1000
,
keylen
=
1
,
lru
=
True
,
tree
=
False
):
max_entries
=
int
(
max_entries
*
CACHE_SIZE_FACTOR
)
if
lru
:
cache_type
=
TreeCache
if
tree
else
dict
self
.
cache
=
LruCache
(
...
...
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