Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
dd068ca9
Commit
dd068ca9
authored
6 years ago
by
Adrian Tschira
Browse files
Options
Downloads
Patches
Plain Diff
remaining isintance fixes
Signed-off-by:
Adrian Tschira
<
nota@notafile.com
>
parent
7ea07c73
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/storage/search.py
+3
-2
3 additions, 2 deletions
synapse/storage/search.py
synapse/util/caches/descriptors.py
+8
-4
8 additions, 4 deletions
synapse/util/caches/descriptors.py
synapse/util/frozenutils.py
+3
-2
3 additions, 2 deletions
synapse/util/frozenutils.py
with
14 additions
and
8 deletions
synapse/storage/search.py
+
3
−
2
View file @
dd068ca9
...
...
@@ -18,13 +18,14 @@ import logging
import
re
import
simplejson
as
json
from
six
import
string_types
from
twisted.internet
import
defer
from
.background_updates
import
BackgroundUpdateStore
from
synapse.api.errors
import
SynapseError
from
synapse.storage.engines
import
PostgresEngine
,
Sqlite3Engine
logger
=
logging
.
getLogger
(
__name__
)
SearchEntry
=
namedtuple
(
'
SearchEntry
'
,
[
...
...
@@ -126,7 +127,7 @@ class SearchStore(BackgroundUpdateStore):
# skip over it.
continue
if
not
isinstance
(
value
,
base
string
):
if
not
isinstance
(
value
,
string
_types
):
# If the event body, name or topic isn't a string
# then skip over it
continue
...
...
This diff is collapsed.
Click to expand it.
synapse/util/caches/descriptors.py
+
8
−
4
View file @
dd068ca9
...
...
@@ -31,6 +31,9 @@ import functools
import
inspect
import
threading
from
six
import
string_types
,
itervalues
import
six
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -205,7 +208,7 @@ class Cache(object):
def
invalidate_all
(
self
):
self
.
check_thread
()
self
.
cache
.
clear
()
for
entry
in
self
.
_pending_deferred_cache
.
itervalues
(
):
for
entry
in
itervalues
(
self
.
_pending_deferred_cache
):
entry
.
invalidate
()
self
.
_pending_deferred_cache
.
clear
()
...
...
@@ -392,9 +395,10 @@ class CacheDescriptor(_CacheDescriptorBase):
ret
.
addErrback
(
onErr
)
# If our cache_key is a string, try to convert to ascii to save
# a bit of space in large caches
if
isinstance
(
cache_key
,
basestring
):
# If our cache_key is a string on py2, try to convert to ascii
# to save a bit of space in large caches. Py3 does this
# internally automatically.
if
six
.
PY2
and
isinstance
(
cache_key
,
string_types
):
cache_key
=
to_ascii
(
cache_key
)
result_d
=
ObservableDeferred
(
ret
,
consumeErrors
=
True
)
...
...
This diff is collapsed.
Click to expand it.
synapse/util/frozenutils.py
+
3
−
2
View file @
dd068ca9
...
...
@@ -16,6 +16,7 @@
from
frozendict
import
frozendict
import
simplejson
as
json
from
six
import
string_types
def
freeze
(
o
):
t
=
type
(
o
)
...
...
@@ -25,7 +26,7 @@ def freeze(o):
if
t
is
frozendict
:
return
o
if
t
is
str
or
t
is
unicode
:
if
isinstance
(
t
,
string_types
)
:
return
o
try
:
...
...
@@ -41,7 +42,7 @@ def unfreeze(o):
if
t
is
dict
or
t
is
frozendict
:
return
dict
({
k
:
unfreeze
(
v
)
for
k
,
v
in
o
.
items
()})
if
t
is
str
or
t
is
unicode
:
if
isinstance
(
t
,
string_types
)
:
return
o
try
:
...
...
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